bitkeeper revision 1.1691.1.13 (42a767bfQ0_UVkV0FEMxkQeSluJPmA)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 8 Jun 2005 21:48:47 +0000 (21:48 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 8 Jun 2005 21:48:47 +0000 (21:48 +0000)
More irq changes: moving towards addressing irqs by vector rather than
'irq index'.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/acpi/boot.c
xen/arch/x86/i8259.c
xen/arch/x86/io_apic.c
xen/arch/x86/irq.c
xen/include/asm-x86/io_apic.h
xen/include/asm-x86/irq.h

index 5b25f53cd5192d8383b503aac53b75d477afec38..c209012950c88b987b026eee16271c330113ecd6 100644 (file)
@@ -88,22 +88,6 @@ EXPORT_SYMBOL(x86_acpiid_to_apicid);
  */
 enum acpi_irq_model_id         acpi_irq_model = ACPI_IRQ_MODEL_PIC;
 
-#if 0/*def     CONFIG_X86_64*/
-
-/* rely on all ACPI tables being in the direct mapping */
-char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
-{
-       if (!phys_addr || !size)
-       return NULL;
-
-       if (phys_addr < (end_pfn_map << PAGE_SHIFT))
-               return __va(phys_addr);
-
-       return NULL;
-}
-
-#else
-
 /*
  * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
  * to map the target physical address. The problem is that set_fixmap()
@@ -143,7 +127,6 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
 
        return ((char *) base + offset);
 }
-#endif
 
 #ifdef CONFIG_PCI_MMCONFIG
 static int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
@@ -289,42 +272,6 @@ acpi_parse_ioapic (
        return 0;
 }
 
-#ifdef CONFIG_ACPI_INTERPRETER
-/*
- * Parse Interrupt Source Override for the ACPI SCI
- */
-static void
-acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
-{
-       if (trigger == 0)       /* compatible SCI trigger is level */
-               trigger = 3;
-
-       if (polarity == 0)      /* compatible SCI polarity is low */
-               polarity = 3;
-
-       /* Command-line over-ride via acpi_sci= */
-       if (acpi_sci_flags.trigger)
-               trigger = acpi_sci_flags.trigger;
-
-       if (acpi_sci_flags.polarity)
-               polarity = acpi_sci_flags.polarity;
-
-       /*
-        * mp_config_acpi_legacy_irqs() already setup IRQs < 16
-        * If GSI is < 16, this will update its flags,
-        * else it will create a new mp_irqs[] entry.
-        */
-       mp_override_legacy_irq(gsi, polarity, trigger, gsi);
-
-       /*
-        * stash over-ride to indicate we've been here
-        * and for later update of acpi_fadt
-        */
-       acpi_sci_override_gsi = gsi;
-       return;
-}
-#endif
-
 static int __init
 acpi_parse_int_src_ovr (
        acpi_table_entry_header *header, const unsigned long end)
@@ -338,14 +285,6 @@ acpi_parse_int_src_ovr (
 
        acpi_table_print_madt_entry(header);
 
-#ifdef CONFIG_ACPI_INTERPRETER
-       if (intsrc->bus_irq == acpi_fadt.sci_int) {
-               acpi_sci_ioapic_setup(intsrc->global_irq,
-                       intsrc->flags.polarity, intsrc->flags.trigger);
-               return 0;
-       }
-#endif
-
        if (acpi_skip_timer_override &&
                intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
                        printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
@@ -382,122 +321,6 @@ acpi_parse_nmi_src (
 
 #endif /* CONFIG_X86_IO_APIC */
 
-#ifdef CONFIG_ACPI_BUS
-
-/*
- * acpi_pic_sci_set_trigger()
- * 
- * use ELCR to set PIC-mode trigger type for SCI
- *
- * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
- * it may require Edge Trigger -- use "acpi_sci=edge"
- *
- * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
- * for the 8259 PIC.  bit[n] = 1 means irq[n] is Level, otherwise Edge.
- * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0)
- * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
- */
-
-void __init
-acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
-{
-       unsigned int mask = 1 << irq;
-       unsigned int old, new;
-
-       /* Real old ELCR mask */
-       old = inb(0x4d0) | (inb(0x4d1) << 8);
-
-       /*
-        * If we use ACPI to set PCI irq's, then we should clear ELCR
-        * since we will set it correctly as we enable the PCI irq
-        * routing.
-        */
-       new = acpi_noirq ? old : 0;
-
-       /*
-        * Update SCI information in the ELCR, it isn't in the PCI
-        * routing tables..
-        */
-       switch (trigger) {
-       case 1: /* Edge - clear */
-               new &= ~mask;
-               break;
-       case 3: /* Level - set */
-               new |= mask;
-               break;
-       }
-
-       if (old == new)
-               return;
-
-       printk(PREFIX "setting ELCR to %04x (from %04x)\n", new, old);
-       outb(new, 0x4d0);
-       outb(new >> 8, 0x4d1);
-}
-
-
-#endif /* CONFIG_ACPI_BUS */
-
-int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
-{
-#ifdef CONFIG_X86_IO_APIC
-       if (use_pci_vector() && !platform_legacy_irq(gsi))
-               *irq = IO_APIC_VECTOR(gsi);
-       else
-#endif
-               *irq = gsi;
-       return 0;
-}
-
-unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
-{
-       unsigned int irq;
-       unsigned int plat_gsi = gsi;
-
-#ifdef CONFIG_PCI
-       /*
-        * Make sure all (legacy) PCI IRQs are set as level-triggered.
-        */
-       if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
-               extern void eisa_set_level_irq(unsigned int irq);
-
-               if (edge_level == ACPI_LEVEL_SENSITIVE)
-                               eisa_set_level_irq(gsi);
-       }
-#endif
-
-#ifdef CONFIG_X86_IO_APIC
-       if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) {
-               plat_gsi = mp_register_gsi(gsi, edge_level, active_high_low);
-       }
-#endif
-       acpi_gsi_to_irq(plat_gsi, &irq);
-       return irq;
-}
-EXPORT_SYMBOL(acpi_register_gsi);
-
-/*
- *  ACPI based hotplug support for CPU
- */
-#ifdef CONFIG_ACPI_HOTPLUG_CPU
-int
-acpi_map_lsapic(acpi_handle handle, int *pcpu)
-{
-       /* TBD */
-       return -EINVAL;
-}
-EXPORT_SYMBOL(acpi_map_lsapic);
-
-
-int
-acpi_unmap_lsapic(int cpu)
-{
-       /* TBD */
-       return -EINVAL;
-}
-EXPORT_SYMBOL(acpi_unmap_lsapic);
-#endif /* CONFIG_ACPI_HOTPLUG_CPU */
-
 static unsigned long __init
 acpi_scan_rsdp (
        unsigned long           start,
index 7e7571fd38b03a8abf90014fdf5831a5789f7527..17128adc35f7ba2643fd60149bfd0516c5c0f30c 100644 (file)
 BUILD_COMMON_IRQ()
 
 #define BI(x,y) \
-       BUILD_IRQ(x##y)
+    BUILD_IRQ(x##y)
 
 #define BUILD_16_IRQS(x) \
-       BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
-       BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
-       BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
-       BI(x,c) BI(x,d) BI(x,e) BI(x,f)
+    BI(x,0) BI(x,1) BI(x,2) BI(x,3) \
+    BI(x,4) BI(x,5) BI(x,6) BI(x,7) \
+    BI(x,8) BI(x,9) BI(x,a) BI(x,b) \
+    BI(x,c) BI(x,d) BI(x,e) BI(x,f)
 
 BUILD_16_IRQS(0x0) BUILD_16_IRQS(0x1) BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3)
 BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
@@ -57,11 +57,9 @@ BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf)
  * is no hardware IRQ pin equivalent for them, they are triggered
  * through the ICC by us (IPIs)
  */
-#ifdef CONFIG_SMP
 BUILD_SMP_INTERRUPT(event_check_interrupt,EVENT_CHECK_VECTOR)
 BUILD_SMP_INTERRUPT(invalidate_interrupt,INVALIDATE_TLB_VECTOR)
 BUILD_SMP_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
-#endif
 
 /*
  * Every pentium local APIC has two 'local interrupts', with a
@@ -75,19 +73,19 @@ BUILD_SMP_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR)
 BUILD_SMP_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR)
 
 #define IRQ(x,y) \
-       IRQ##x##y##_interrupt
+    IRQ##x##y##_interrupt
 
 #define IRQLIST_16(x) \
-       IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
-       IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
-       IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
-       IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
+    IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \
+    IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \
+    IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \
+    IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f)
 
     static void (*interrupt[])(void) = {
-       IRQLIST_16(0x0), IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3),
-       IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
-       IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
-       IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf)
+        IRQLIST_16(0x0), IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3),
+        IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7),
+        IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
+        IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf)
     };
 
 #undef IRQ
@@ -104,31 +102,38 @@ BUILD_SMP_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR)
 
 spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED;
 
-static void end_8259A_irq (unsigned int irq)
+static void disable_8259A_vector(unsigned int vector)
 {
-    if (!(irq_desc[irq_to_vector(irq)].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-        enable_8259A_irq(irq);
+    disable_8259A_irq(LEGACY_IRQ_FROM_VECTOR(vector));
 }
 
-#define shutdown_8259A_irq     disable_8259A_irq
+static void enable_8259A_vector(unsigned int vector)
+{
+    enable_8259A_irq(LEGACY_IRQ_FROM_VECTOR(vector));
+}
+
+static void mask_and_ack_8259A_vector(unsigned int);
 
-void mask_and_ack_8259A(unsigned int);
+static void end_8259A_vector(unsigned int vector)
+{
+    if (!(irq_desc[vector].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+        enable_8259A_vector(vector);
+}
 
-static unsigned int startup_8259A_irq(unsigned int irq)
+static unsigned int startup_8259A_vector(unsigned int vector)
 { 
-    enable_8259A_irq(irq);
+    enable_8259A_vector(vector);
     return 0; /* never anything pending */
 }
 
 static struct hw_interrupt_type i8259A_irq_type = {
-    "XT-PIC",
-    startup_8259A_irq,
-    shutdown_8259A_irq,
-    enable_8259A_irq,
-    disable_8259A_irq,
-    mask_and_ack_8259A,
-    end_8259A_irq,
-    NULL
+    .typename = "XT-PIC",
+    .startup  = startup_8259A_vector,
+    .shutdown = disable_8259A_vector,
+    .enable   = enable_8259A_vector,
+    .disable  = disable_8259A_vector,
+    .ack      = mask_and_ack_8259A_vector,
+    .end      = end_8259A_vector
 };
 
 /*
@@ -140,9 +145,9 @@ static struct hw_interrupt_type i8259A_irq_type = {
  */
 static unsigned int cached_irq_mask = 0xffff;
 
-#define __byte(x,y)    (((unsigned char *)&(y))[x])
-#define cached_21      (__byte(0,cached_irq_mask))
-#define cached_A1      (__byte(1,cached_irq_mask))
+#define __byte(x,y) (((unsigned char *)&(y))[x])
+#define cached_21   (__byte(0,cached_irq_mask))
+#define cached_A1   (__byte(1,cached_irq_mask))
 
 /*
  * Not all IRQs can be routed through the IO-APIC, eg. on certain (older)
@@ -203,7 +208,6 @@ void make_8259A_irq(unsigned int irq)
 {
     disable_irq_nosync(irq);
     io_apic_irqs &= ~(1<<irq);
-    irq_desc[irq_to_vector(irq)].handler = &i8259A_irq_type;
     enable_irq(irq);
 }
 
@@ -219,14 +223,14 @@ static inline int i8259A_irq_real(unsigned int irq)
     int irqmask = 1<<irq;
 
     if (irq < 8) {
-        outb(0x0B,0x20);               /* ISR register */
+        outb(0x0B,0x20);                /* ISR register */
         value = inb(0x20) & irqmask;
-        outb(0x0A,0x20);               /* back to the IRR register */
+        outb(0x0A,0x20);                /* back to the IRR register */
         return value;
     }
-    outb(0x0B,0xA0);           /* ISR register */
+    outb(0x0B,0xA0);                    /* ISR register */
     value = inb(0xA0) & (irqmask >> 8);
-    outb(0x0A,0xA0);           /* back to the IRR register */
+    outb(0x0A,0xA0);                    /* back to the IRR register */
     return value;
 }
 
@@ -236,8 +240,9 @@ static inline int i8259A_irq_real(unsigned int irq)
  * first, _then_ send the EOI, and the order of EOI
  * to the two 8259s is important!
  */
-void mask_and_ack_8259A(unsigned int irq)
+static void mask_and_ack_8259A_vector(unsigned int vector)
 {
+    unsigned int irq = LEGACY_IRQ_FROM_VECTOR(vector);
     unsigned int irqmask = 1 << irq;
     unsigned long flags;
 
@@ -263,14 +268,14 @@ void mask_and_ack_8259A(unsigned int irq)
 
  handle_real_irq:
     if (irq & 8) {
-        inb(0xA1);             /* DUMMY - (do we need this?) */
+        inb(0xA1);              /* DUMMY - (do we need this?) */
         outb(cached_A1,0xA1);
         outb(0x60+(irq&7),0xA0);/* 'Specific EOI' to slave */
-        outb(0x62,0x20);       /* 'Specific EOI' to master-IRQ2 */
+        outb(0x62,0x20);        /* 'Specific EOI' to master-IRQ2 */
     } else {
-        inb(0x21);             /* DUMMY - (do we need this?) */
+        inb(0x21);              /* DUMMY - (do we need this?) */
         outb(cached_21,0x21);
-        outb(0x60+irq,0x20);   /* 'Specific EOI' to master */
+        outb(0x60+irq,0x20);    /* 'Specific EOI' to master */
     }
     spin_unlock_irqrestore(&i8259A_lock, flags);
     return;
@@ -312,39 +317,39 @@ void __init init_8259A(int auto_eoi)
 
     spin_lock_irqsave(&i8259A_lock, flags);
 
-    outb(0xff, 0x21);  /* mask all of 8259A-1 */
-    outb(0xff, 0xA1);  /* mask all of 8259A-2 */
+    outb(0xff, 0x21);   /* mask all of 8259A-1 */
+    outb(0xff, 0xA1);   /* mask all of 8259A-2 */
 
     /*
      * outb_p - this has to work on a wide range of PC hardware.
      */
-    outb_p(0x11, 0x20);        /* ICW1: select 8259A-1 init */
-    outb_p(0x20 + 0, 0x21);    /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */
-    outb_p(0x04, 0x21);        /* 8259A-1 (the master) has a slave on IR2 */
+    outb_p(0x11, 0x20);     /* ICW1: select 8259A-1 init */
+    outb_p(0x20 + 0, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */
+    outb_p(0x04, 0x21);     /* 8259A-1 (the master) has a slave on IR2 */
     if (auto_eoi)
-        outb_p(0x03, 0x21);    /* master does Auto EOI */
+        outb_p(0x03, 0x21); /* master does Auto EOI */
     else
-        outb_p(0x01, 0x21);    /* master expects normal EOI */
+        outb_p(0x01, 0x21); /* master expects normal EOI */
 
-    outb_p(0x11, 0xA0);        /* ICW1: select 8259A-2 init */
-    outb_p(0x20 + 8, 0xA1);    /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */
-    outb_p(0x02, 0xA1);        /* 8259A-2 is a slave on master's IR2 */
-    outb_p(0x01, 0xA1);        /* (slave's support for AEOI in flat mode
-                           is to be investigated) */
+    outb_p(0x11, 0xA0);     /* ICW1: select 8259A-2 init */
+    outb_p(0x20 + 8, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */
+    outb_p(0x02, 0xA1);     /* 8259A-2 is a slave on master's IR2 */
+    outb_p(0x01, 0xA1);     /* (slave's support for AEOI in flat mode
+                               is to be investigated) */
 
     if (auto_eoi)
         /*
          * in AEOI mode we just have to mask the interrupt
          * when acking.
          */
-        i8259A_irq_type.ack = disable_8259A_irq;
+        i8259A_irq_type.ack = disable_8259A_vector;
     else
-        i8259A_irq_type.ack = mask_and_ack_8259A;
+        i8259A_irq_type.ack = mask_and_ack_8259A_vector;
 
-    udelay(100);               /* wait for 8259A to initialize */
+    udelay(100);            /* wait for 8259A to initialize */
 
-    outb(cached_21, 0x21);     /* restore master IRQ mask */
-    outb(cached_A1, 0xA1);     /* restore slave IRQ mask */
+    outb(cached_21, 0x21);  /* restore master IRQ mask */
+    outb(cached_A1, 0xA1);  /* restore slave IRQ mask */
 
     spin_unlock_irqrestore(&i8259A_lock, flags);
 }
@@ -397,9 +402,9 @@ void __init init_IRQ(void)
     /* Set the clock to HZ Hz */
 #define CLOCK_TICK_RATE 1193180 /* crystal freq (Hz) */
 #define LATCH (((CLOCK_TICK_RATE)+(HZ/2))/HZ)
-    outb_p(0x34,0x43);         /* binary, mode 2, LSB/MSB, ch 0 */
-    outb_p(LATCH & 0xff , 0x40);       /* LSB */
-    outb(LATCH >> 8 , 0x40);   /* MSB */
+    outb_p(0x34,0x43);           /* binary, mode 2, LSB/MSB, ch 0 */
+    outb_p(LATCH & 0xff , 0x40); /* LSB */
+    outb(LATCH >> 8 , 0x40);     /* MSB */
 
     setup_irq(2, &cascade);
 }
index 672d28cf04adb77a82873f6c84d95d4910c3bb67..f41de09f1a05dc154f42fca14f4341cc7093b920 100644 (file)
@@ -61,18 +61,10 @@ int nr_ioapic_registers[MAX_IO_APICS];
  */
 
 static struct irq_pin_list {
-       int apic, pin, next;
+    int apic, pin, next;
 } irq_2_pin[PIN_MAP_SIZE];
 
 int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
-#if 0
-#ifdef CONFIG_PCI_MSI
-#define vector_to_irq(vector)  \
-       (platform_legacy_irq(vector) ? vector : vector_irq[vector])
-#else
-#define vector_to_irq(vector)  (vector)
-#endif
-#endif
 
 /*
  * The common case is 1:1 IRQ<->pin mappings. Sometimes there are
@@ -81,20 +73,20 @@ int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
  */
 static void add_pin_to_irq(unsigned int irq, int apic, int pin)
 {
-       static int first_free_entry = NR_IRQS;
-       struct irq_pin_list *entry = irq_2_pin + irq;
+    static int first_free_entry = NR_IRQS;
+    struct irq_pin_list *entry = irq_2_pin + irq;
 
-       while (entry->next)
-               entry = irq_2_pin + entry->next;
+    while (entry->next)
+        entry = irq_2_pin + entry->next;
 
-       if (entry->pin != -1) {
-               entry->next = first_free_entry;
-               entry = irq_2_pin + entry->next;
-               if (++first_free_entry >= PIN_MAP_SIZE)
-                       panic("io_apic.c: whoops");
-       }
-       entry->apic = apic;
-       entry->pin = pin;
+    if (entry->pin != -1) {
+        entry->next = first_free_entry;
+        entry = irq_2_pin + entry->next;
+        if (++first_free_entry >= PIN_MAP_SIZE)
+            panic("io_apic.c: whoops");
+    }
+    entry->apic = apic;
+    entry->pin = pin;
 }
 
 /*
@@ -104,134 +96,134 @@ static void __init replace_pin_at_irq(unsigned int irq,
                                      int oldapic, int oldpin,
                                      int newapic, int newpin)
 {
-       struct irq_pin_list *entry = irq_2_pin + irq;
-
-       while (1) {
-               if (entry->apic == oldapic && entry->pin == oldpin) {
-                       entry->apic = newapic;
-                       entry->pin = newpin;
-               }
-               if (!entry->next)
-                       break;
-               entry = irq_2_pin + entry->next;
-       }
+    struct irq_pin_list *entry = irq_2_pin + irq;
+
+    while (1) {
+        if (entry->apic == oldapic && entry->pin == oldpin) {
+            entry->apic = newapic;
+            entry->pin = newpin;
+        }
+        if (!entry->next)
+            break;
+        entry = irq_2_pin + entry->next;
+    }
 }
 
 static void __modify_IO_APIC_irq (unsigned int irq, unsigned long enable, unsigned long disable)
 {
-       struct irq_pin_list *entry = irq_2_pin + irq;
-       unsigned int pin, reg;
-
-       for (;;) {
-               pin = entry->pin;
-               if (pin == -1)
-                       break;
-               reg = io_apic_read(entry->apic, 0x10 + pin*2);
-               reg &= ~disable;
-               reg |= enable;
-               io_apic_modify(entry->apic, 0x10 + pin*2, reg);
-               if (!entry->next)
-                       break;
-               entry = irq_2_pin + entry->next;
-       }
+    struct irq_pin_list *entry = irq_2_pin + irq;
+    unsigned int pin, reg;
+
+    for (;;) {
+        pin = entry->pin;
+        if (pin == -1)
+            break;
+        reg = io_apic_read(entry->apic, 0x10 + pin*2);
+        reg &= ~disable;
+        reg |= enable;
+        io_apic_modify(entry->apic, 0x10 + pin*2, reg);
+        if (!entry->next)
+            break;
+        entry = irq_2_pin + entry->next;
+    }
 }
 
 /* mask = 1 */
 static void __mask_IO_APIC_irq (unsigned int irq)
 {
-       __modify_IO_APIC_irq(irq, 0x00010000, 0);
+    __modify_IO_APIC_irq(irq, 0x00010000, 0);
 }
 
 /* mask = 0 */
 static void __unmask_IO_APIC_irq (unsigned int irq)
 {
-       __modify_IO_APIC_irq(irq, 0, 0x00010000);
+    __modify_IO_APIC_irq(irq, 0, 0x00010000);
 }
 
 /* trigger = 0 */
 static void __edge_IO_APIC_irq (unsigned int irq)
 {
-       __modify_IO_APIC_irq(irq, 0, 0x00008000);
+    __modify_IO_APIC_irq(irq, 0, 0x00008000);
 }
 
 /* trigger = 1 */
 static void __level_IO_APIC_irq (unsigned int irq)
 {
-       __modify_IO_APIC_irq(irq, 0x00008000, 0);
+    __modify_IO_APIC_irq(irq, 0x00008000, 0);
 }
 
 static void mask_IO_APIC_irq (unsigned int irq)
 {
-       unsigned long flags;
+    unsigned long flags;
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       __mask_IO_APIC_irq(irq);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    __mask_IO_APIC_irq(irq);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
 static void unmask_IO_APIC_irq (unsigned int irq)
 {
-       unsigned long flags;
+    unsigned long flags;
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       __unmask_IO_APIC_irq(irq);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    __unmask_IO_APIC_irq(irq);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
 void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
 {
-       struct IO_APIC_route_entry entry;
-       unsigned long flags;
+    struct IO_APIC_route_entry entry;
+    unsigned long flags;
        
-       /* Check delivery_mode to be sure we're not clearing an SMI pin */
-       spin_lock_irqsave(&ioapic_lock, flags);
-       *(((int*)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
-       *(((int*)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
-       if (entry.delivery_mode == dest_SMI)
-               return;
-
-       /*
-        * Disable it in the IO-APIC irq-routing table:
-        */
-       memset(&entry, 0, sizeof(entry));
-       entry.mask = 1;
-       spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry) + 0));
-       io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry) + 1));
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    /* Check delivery_mode to be sure we're not clearing an SMI pin */
+    spin_lock_irqsave(&ioapic_lock, flags);
+    *(((int*)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
+    *(((int*)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
+    if (entry.delivery_mode == dest_SMI)
+        return;
+
+    /*
+     * Disable it in the IO-APIC irq-routing table:
+     */
+    memset(&entry, 0, sizeof(entry));
+    entry.mask = 1;
+    spin_lock_irqsave(&ioapic_lock, flags);
+    io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry) + 0));
+    io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry) + 1));
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
 static void clear_IO_APIC (void)
 {
-       int apic, pin;
+    int apic, pin;
 
-       for (apic = 0; apic < nr_ioapics; apic++)
-               for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
-                       clear_IO_APIC_pin(apic, pin);
+    for (apic = 0; apic < nr_ioapics; apic++)
+        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
+            clear_IO_APIC_pin(apic, pin);
 }
 
 static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
 {
-       unsigned long flags;
-       int pin;
-       struct irq_pin_list *entry = irq_2_pin + irq;
-       unsigned int apicid_value;
+    unsigned long flags;
+    int pin;
+    struct irq_pin_list *entry = irq_2_pin + irq;
+    unsigned int apicid_value;
        
-       apicid_value = cpu_mask_to_apicid(cpumask);
-       /* Prepare to do the io_apic_write */
-       apicid_value = apicid_value << 24;
-       spin_lock_irqsave(&ioapic_lock, flags);
-       for (;;) {
-               pin = entry->pin;
-               if (pin == -1)
-                       break;
-               io_apic_write(entry->apic, 0x10 + 1 + pin*2, apicid_value);
-               if (!entry->next)
-                       break;
-               entry = irq_2_pin + entry->next;
-       }
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    apicid_value = cpu_mask_to_apicid(cpumask);
+    /* Prepare to do the io_apic_write */
+    apicid_value = apicid_value << 24;
+    spin_lock_irqsave(&ioapic_lock, flags);
+    for (;;) {
+        pin = entry->pin;
+        if (pin == -1)
+            break;
+        io_apic_write(entry->apic, 0x10 + 1 + pin*2, apicid_value);
+        if (!entry->next)
+            break;
+        entry = irq_2_pin + entry->next;
+    }
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
 /*
@@ -239,16 +231,16 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
  */
 static int find_irq_entry(int apic, int pin, int type)
 {
-       int i;
+    int i;
 
-       for (i = 0; i < mp_irq_entries; i++)
-               if (mp_irqs[i].mpc_irqtype == type &&
-                   (mp_irqs[i].mpc_dstapic == mp_ioapics[apic].mpc_apicid ||
-                    mp_irqs[i].mpc_dstapic == MP_APIC_ALL) &&
-                   mp_irqs[i].mpc_dstirq == pin)
-                       return i;
+    for (i = 0; i < mp_irq_entries; i++)
+        if (mp_irqs[i].mpc_irqtype == type &&
+            (mp_irqs[i].mpc_dstapic == mp_ioapics[apic].mpc_apicid ||
+             mp_irqs[i].mpc_dstapic == MP_APIC_ALL) &&
+            mp_irqs[i].mpc_dstirq == pin)
+            return i;
 
-       return -1;
+    return -1;
 }
 
 /*
@@ -256,22 +248,22 @@ static int find_irq_entry(int apic, int pin, int type)
  */
 static int find_isa_irq_pin(int irq, int type)
 {
-       int i;
+    int i;
 
-       for (i = 0; i < mp_irq_entries; i++) {
-               int lbus = mp_irqs[i].mpc_srcbus;
+    for (i = 0; i < mp_irq_entries; i++) {
+        int lbus = mp_irqs[i].mpc_srcbus;
 
-               if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA ||
-                    mp_bus_id_to_type[lbus] == MP_BUS_EISA ||
-                    mp_bus_id_to_type[lbus] == MP_BUS_MCA ||
-                    mp_bus_id_to_type[lbus] == MP_BUS_NEC98
-                   ) &&
-                   (mp_irqs[i].mpc_irqtype == type) &&
-                   (mp_irqs[i].mpc_srcbusirq == irq))
+        if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA ||
+             mp_bus_id_to_type[lbus] == MP_BUS_EISA ||
+             mp_bus_id_to_type[lbus] == MP_BUS_MCA ||
+             mp_bus_id_to_type[lbus] == MP_BUS_NEC98
+            ) &&
+            (mp_irqs[i].mpc_irqtype == type) &&
+            (mp_irqs[i].mpc_srcbusirq == irq))
 
-                       return mp_irqs[i].mpc_dstirq;
-       }
-       return -1;
+            return mp_irqs[i].mpc_dstirq;
+    }
+    return -1;
 }
 
 /*
@@ -280,68 +272,28 @@ static int find_isa_irq_pin(int irq, int type)
  */
 static int pin_2_irq(int idx, int apic, int pin);
 
-int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
-{
-       int apic, i, best_guess = -1;
-
-       apic_printk(APIC_DEBUG, "querying PCI -> IRQ mapping bus:%d, "
-               "slot:%d, pin:%d.\n", bus, slot, pin);
-       if (mp_bus_id_to_pci_bus[bus] == -1) {
-               printk(KERN_WARNING "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
-               return -1;
-       }
-       for (i = 0; i < mp_irq_entries; i++) {
-               int lbus = mp_irqs[i].mpc_srcbus;
-
-               for (apic = 0; apic < nr_ioapics; apic++)
-                       if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic ||
-                           mp_irqs[i].mpc_dstapic == MP_APIC_ALL)
-                               break;
-
-               if ((mp_bus_id_to_type[lbus] == MP_BUS_PCI) &&
-                   !mp_irqs[i].mpc_irqtype &&
-                   (bus == lbus) &&
-                   (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) {
-                       int irq = pin_2_irq(i,apic,mp_irqs[i].mpc_dstirq);
-
-                       if (!(apic || IO_APIC_IRQ(irq)))
-                               continue;
-
-                       if (pin == (mp_irqs[i].mpc_srcbusirq & 3))
-                               return irq;
-                       /*
-                        * Use the first all-but-pin matching entry as a
-                        * best-guess fuzzy result for broken mptables.
-                        */
-                       if (best_guess < 0)
-                               best_guess = irq;
-               }
-       }
-       return best_guess;
-}
-
 /*
- * This function currently is only a helper for the i386 smp boot process where 
- * we need to reprogram the ioredtbls to cater for the cpus which have come online
- * so mask in all cases should simply be TARGET_CPUS
+ * This function currently is only a helper for the i386 smp boot process where
+ * we need to reprogram the ioredtbls to cater for the cpus which have come
+ * online so mask in all cases should simply be TARGET_CPUS
  */
 void __init setup_ioapic_dest(void)
 {
-       int pin, ioapic, irq, irq_entry;
-
-       if (skip_ioapic_setup == 1)
-               return;
-
-       for (ioapic = 0; ioapic < nr_ioapics; ioapic++) {
-               for (pin = 0; pin < nr_ioapic_registers[ioapic]; pin++) {
-                       irq_entry = find_irq_entry(ioapic, pin, mp_INT);
-                       if (irq_entry == -1)
-                               continue;
-                       irq = pin_2_irq(irq_entry, ioapic, pin);
-                       set_ioapic_affinity_irq(irq, TARGET_CPUS);
-               }
+    int pin, ioapic, irq, irq_entry;
+
+    if (skip_ioapic_setup == 1)
+        return;
+
+    for (ioapic = 0; ioapic < nr_ioapics; ioapic++) {
+        for (pin = 0; pin < nr_ioapic_registers[ioapic]; pin++) {
+            irq_entry = find_irq_entry(ioapic, pin, mp_INT);
+            if (irq_entry == -1)
+                continue;
+            irq = pin_2_irq(irq_entry, ioapic, pin);
+            set_ioapic_affinity_irq(irq, TARGET_CPUS);
+        }
 
-       }
+    }
 }
 
 /*
@@ -349,13 +301,13 @@ void __init setup_ioapic_dest(void)
  */
 static int EISA_ELCR(unsigned int irq)
 {
-       if (irq < 16) {
-               unsigned int port = 0x4d0 + (irq >> 3);
-               return (inb(port) >> (irq & 7)) & 1;
-       }
-       apic_printk(APIC_VERBOSE, KERN_INFO
-                       "Broken MPtable reports ISA irq %d\n", irq);
-       return 0;
+    if (irq < 16) {
+        unsigned int port = 0x4d0 + (irq >> 3);
+        return (inb(port) >> (irq & 7)) & 1;
+    }
+    apic_printk(APIC_VERBOSE, KERN_INFO
+                "Broken MPtable reports ISA irq %d\n", irq);
+    return 0;
 }
 
 /* EISA interrupts are always polarity zero and can be edge or level
@@ -392,227 +344,227 @@ static int EISA_ELCR(unsigned int irq)
 
 static int __init MPBIOS_polarity(int idx)
 {
-       int bus = mp_irqs[idx].mpc_srcbus;
-       int polarity;
+    int bus = mp_irqs[idx].mpc_srcbus;
+    int polarity;
 
-       /*
-        * Determine IRQ line polarity (high active or low active):
-        */
-       switch (mp_irqs[idx].mpc_irqflag & 3)
-       {
-               case 0: /* conforms, ie. bus-type dependent polarity */
-               {
-                       switch (mp_bus_id_to_type[bus])
-                       {
-                               case MP_BUS_ISA: /* ISA pin */
-                               {
-                                       polarity = default_ISA_polarity(idx);
-                                       break;
-                               }
-                               case MP_BUS_EISA: /* EISA pin */
-                               {
-                                       polarity = default_EISA_polarity(idx);
-                                       break;
-                               }
-                               case MP_BUS_PCI: /* PCI pin */
-                               {
-                                       polarity = default_PCI_polarity(idx);
-                                       break;
-                               }
-                               case MP_BUS_MCA: /* MCA pin */
-                               {
-                                       polarity = default_MCA_polarity(idx);
-                                       break;
-                               }
-                               case MP_BUS_NEC98: /* NEC 98 pin */
-                               {
-                                       polarity = default_NEC98_polarity(idx);
-                                       break;
-                               }
-                               default:
-                               {
-                                       printk(KERN_WARNING "broken BIOS!!\n");
-                                       polarity = 1;
-                                       break;
-                               }
-                       }
-                       break;
-               }
-               case 1: /* high active */
-               {
-                       polarity = 0;
-                       break;
-               }
-               case 2: /* reserved */
-               {
-                       printk(KERN_WARNING "broken BIOS!!\n");
-                       polarity = 1;
-                       break;
-               }
-               case 3: /* low active */
-               {
-                       polarity = 1;
-                       break;
-               }
-               default: /* invalid */
-               {
-                       printk(KERN_WARNING "broken BIOS!!\n");
-                       polarity = 1;
-                       break;
-               }
-       }
-       return polarity;
+    /*
+     * Determine IRQ line polarity (high active or low active):
+     */
+    switch (mp_irqs[idx].mpc_irqflag & 3)
+    {
+    case 0: /* conforms, ie. bus-type dependent polarity */
+    {
+        switch (mp_bus_id_to_type[bus])
+        {
+        case MP_BUS_ISA: /* ISA pin */
+        {
+            polarity = default_ISA_polarity(idx);
+            break;
+        }
+        case MP_BUS_EISA: /* EISA pin */
+        {
+            polarity = default_EISA_polarity(idx);
+            break;
+        }
+        case MP_BUS_PCI: /* PCI pin */
+        {
+            polarity = default_PCI_polarity(idx);
+            break;
+        }
+        case MP_BUS_MCA: /* MCA pin */
+        {
+            polarity = default_MCA_polarity(idx);
+            break;
+        }
+        case MP_BUS_NEC98: /* NEC 98 pin */
+        {
+            polarity = default_NEC98_polarity(idx);
+            break;
+        }
+        default:
+        {
+            printk(KERN_WARNING "broken BIOS!!\n");
+            polarity = 1;
+            break;
+        }
+        }
+        break;
+    }
+    case 1: /* high active */
+    {
+        polarity = 0;
+        break;
+    }
+    case 2: /* reserved */
+    {
+        printk(KERN_WARNING "broken BIOS!!\n");
+        polarity = 1;
+        break;
+    }
+    case 3: /* low active */
+    {
+        polarity = 1;
+        break;
+    }
+    default: /* invalid */
+    {
+        printk(KERN_WARNING "broken BIOS!!\n");
+        polarity = 1;
+        break;
+    }
+    }
+    return polarity;
 }
 
 static int MPBIOS_trigger(int idx)
 {
-       int bus = mp_irqs[idx].mpc_srcbus;
-       int trigger;
+    int bus = mp_irqs[idx].mpc_srcbus;
+    int trigger;
 
-       /*
-        * Determine IRQ trigger mode (edge or level sensitive):
-        */
-       switch ((mp_irqs[idx].mpc_irqflag>>2) & 3)
-       {
-               case 0: /* conforms, ie. bus-type dependent */
-               {
-                       switch (mp_bus_id_to_type[bus])
-                       {
-                               case MP_BUS_ISA: /* ISA pin */
-                               {
-                                       trigger = default_ISA_trigger(idx);
-                                       break;
-                               }
-                               case MP_BUS_EISA: /* EISA pin */
-                               {
-                                       trigger = default_EISA_trigger(idx);
-                                       break;
-                               }
-                               case MP_BUS_PCI: /* PCI pin */
-                               {
-                                       trigger = default_PCI_trigger(idx);
-                                       break;
-                               }
-                               case MP_BUS_MCA: /* MCA pin */
-                               {
-                                       trigger = default_MCA_trigger(idx);
-                                       break;
-                               }
-                               case MP_BUS_NEC98: /* NEC 98 pin */
-                               {
-                                       trigger = default_NEC98_trigger(idx);
-                                       break;
-                               }
-                               default:
-                               {
-                                       printk(KERN_WARNING "broken BIOS!!\n");
-                                       trigger = 1;
-                                       break;
-                               }
-                       }
-                       break;
-               }
-               case 1: /* edge */
-               {
-                       trigger = 0;
-                       break;
-               }
-               case 2: /* reserved */
-               {
-                       printk(KERN_WARNING "broken BIOS!!\n");
-                       trigger = 1;
-                       break;
-               }
-               case 3: /* level */
-               {
-                       trigger = 1;
-                       break;
-               }
-               default: /* invalid */
-               {
-                       printk(KERN_WARNING "broken BIOS!!\n");
-                       trigger = 0;
-                       break;
-               }
-       }
-       return trigger;
+    /*
+     * Determine IRQ trigger mode (edge or level sensitive):
+     */
+    switch ((mp_irqs[idx].mpc_irqflag>>2) & 3)
+    {
+    case 0: /* conforms, ie. bus-type dependent */
+    {
+        switch (mp_bus_id_to_type[bus])
+        {
+        case MP_BUS_ISA: /* ISA pin */
+        {
+            trigger = default_ISA_trigger(idx);
+            break;
+        }
+        case MP_BUS_EISA: /* EISA pin */
+        {
+            trigger = default_EISA_trigger(idx);
+            break;
+        }
+        case MP_BUS_PCI: /* PCI pin */
+        {
+            trigger = default_PCI_trigger(idx);
+            break;
+        }
+        case MP_BUS_MCA: /* MCA pin */
+        {
+            trigger = default_MCA_trigger(idx);
+            break;
+        }
+        case MP_BUS_NEC98: /* NEC 98 pin */
+        {
+            trigger = default_NEC98_trigger(idx);
+            break;
+        }
+        default:
+        {
+            printk(KERN_WARNING "broken BIOS!!\n");
+            trigger = 1;
+            break;
+        }
+        }
+        break;
+    }
+    case 1: /* edge */
+    {
+        trigger = 0;
+        break;
+    }
+    case 2: /* reserved */
+    {
+        printk(KERN_WARNING "broken BIOS!!\n");
+        trigger = 1;
+        break;
+    }
+    case 3: /* level */
+    {
+        trigger = 1;
+        break;
+    }
+    default: /* invalid */
+    {
+        printk(KERN_WARNING "broken BIOS!!\n");
+        trigger = 0;
+        break;
+    }
+    }
+    return trigger;
 }
 
 static inline int irq_polarity(int idx)
 {
-       return MPBIOS_polarity(idx);
+    return MPBIOS_polarity(idx);
 }
 
 static inline int irq_trigger(int idx)
 {
-       return MPBIOS_trigger(idx);
+    return MPBIOS_trigger(idx);
 }
 
 static int pin_2_irq(int idx, int apic, int pin)
 {
-       int irq, i;
-       int bus = mp_irqs[idx].mpc_srcbus;
+    int irq, i;
+    int bus = mp_irqs[idx].mpc_srcbus;
 
-       /*
-        * Debugging check, we are in big trouble if this message pops up!
-        */
-       if (mp_irqs[idx].mpc_dstirq != pin)
-               printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n");
-
-       switch (mp_bus_id_to_type[bus])
-       {
-               case MP_BUS_ISA: /* ISA pin */
-               case MP_BUS_EISA:
-               case MP_BUS_MCA:
-               case MP_BUS_NEC98:
-               {
-                       irq = mp_irqs[idx].mpc_srcbusirq;
-                       break;
-               }
-               case MP_BUS_PCI: /* PCI pin */
-               {
-                       /*
-                        * PCI IRQs are mapped in order
-                        */
-                       i = irq = 0;
-                       while (i < apic)
-                               irq += nr_ioapic_registers[i++];
-                       irq += pin;
-
-                       /*
-                        * For MPS mode, so far only needed by ES7000 platform
-                        */
-                       if (ioapic_renumber_irq)
-                               irq = ioapic_renumber_irq(apic, irq);
-
-                       break;
-               }
-               default:
-               {
-                       printk(KERN_ERR "unknown bus type %d.\n",bus); 
-                       irq = 0;
-                       break;
-               }
-       }
+    /*
+     * Debugging check, we are in big trouble if this message pops up!
+     */
+    if (mp_irqs[idx].mpc_dstirq != pin)
+        printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n");
 
-       return irq;
+    switch (mp_bus_id_to_type[bus])
+    {
+    case MP_BUS_ISA: /* ISA pin */
+    case MP_BUS_EISA:
+    case MP_BUS_MCA:
+    case MP_BUS_NEC98:
+    {
+        irq = mp_irqs[idx].mpc_srcbusirq;
+        break;
+    }
+    case MP_BUS_PCI: /* PCI pin */
+    {
+        /*
+         * PCI IRQs are mapped in order
+         */
+        i = irq = 0;
+        while (i < apic)
+            irq += nr_ioapic_registers[i++];
+        irq += pin;
+
+        /*
+         * For MPS mode, so far only needed by ES7000 platform
+         */
+        if (ioapic_renumber_irq)
+            irq = ioapic_renumber_irq(apic, irq);
+
+        break;
+    }
+    default:
+    {
+        printk(KERN_ERR "unknown bus type %d.\n",bus); 
+        irq = 0;
+        break;
+    }
+    }
+
+    return irq;
 }
 
 static inline int IO_APIC_irq_trigger(int irq)
 {
-       int apic, idx, pin;
-
-       for (apic = 0; apic < nr_ioapics; apic++) {
-               for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
-                       idx = find_irq_entry(apic,pin,mp_INT);
-                       if ((idx != -1) && (irq == pin_2_irq(idx,apic,pin)))
-                               return irq_trigger(idx);
-               }
-       }
-       /*
-        * nonexistent IRQs are edge default
-        */
-       return 0;
+    int apic, idx, pin;
+
+    for (apic = 0; apic < nr_ioapics; apic++) {
+        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
+            idx = find_irq_entry(apic,pin,mp_INT);
+            if ((idx != -1) && (irq == pin_2_irq(idx,apic,pin)))
+                return irq_trigger(idx);
+        }
+    }
+    /*
+     * nonexistent IRQs are edge default
+     */
+    return 0;
 }
 
 /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
@@ -620,34 +572,34 @@ u8 irq_vector[NR_IRQ_VECTORS];
 
 int assign_irq_vector(int irq)
 {
-       static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
-
-       BUG_ON(irq >= NR_IRQ_VECTORS);
-       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
-               return IO_APIC_VECTOR(irq);
-next:
-       current_vector += 8;
-
-       /* Skip the hypercall vector. */
-       if (current_vector == HYPERCALL_VECTOR)
-               goto next;
-
-       /* Skip the Linux/BSD fast-trap vector. */
-       if (current_vector == 0x80)
-               goto next;
-
-       if (current_vector >= FIRST_SYSTEM_VECTOR) {
-               offset++;
-               if (!(offset%8))
-                       return -ENOSPC;
-               current_vector = FIRST_DEVICE_VECTOR + offset;
-       }
+    static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
+
+    BUG_ON(irq >= NR_IRQ_VECTORS);
+    if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
+        return IO_APIC_VECTOR(irq);
+ next:
+    current_vector += 8;
+
+    /* Skip the hypercall vector. */
+    if (current_vector == HYPERCALL_VECTOR)
+        goto next;
+
+    /* Skip the Linux/BSD fast-trap vector. */
+    if (current_vector == 0x80)
+        goto next;
+
+    if (current_vector >= FIRST_SYSTEM_VECTOR) {
+        offset++;
+        if (!(offset%8))
+            return -ENOSPC;
+        current_vector = FIRST_DEVICE_VECTOR + offset;
+    }
 
-       vector_irq[current_vector] = irq;
-       if (irq != AUTO_ASSIGN)
-               IO_APIC_VECTOR(irq) = current_vector;
+    vector_irq[current_vector] = irq;
+    if (irq != AUTO_ASSIGN)
+        IO_APIC_VECTOR(irq) = current_vector;
 
-       return current_vector;
+    return current_vector;
 }
 
 static struct hw_interrupt_type ioapic_level_type;
@@ -659,87 +611,87 @@ static struct hw_interrupt_type ioapic_edge_type;
 
 static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 {
-       if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-               trigger == IOAPIC_LEVEL)
-               irq_desc[vector].handler = &ioapic_level_type;
-       else
-               irq_desc[vector].handler = &ioapic_edge_type;
+    if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
+        trigger == IOAPIC_LEVEL)
+        irq_desc[vector].handler = &ioapic_level_type;
+    else
+        irq_desc[vector].handler = &ioapic_edge_type;
 }
 
 void __init setup_IO_APIC_irqs(void)
 {
-       struct IO_APIC_route_entry entry;
-       int apic, pin, idx, irq, first_notcon = 1, vector;
-       unsigned long flags;
+    struct IO_APIC_route_entry entry;
+    int apic, pin, idx, irq, first_notcon = 1, vector;
+    unsigned long flags;
 
-       apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
+    apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
 
-       for (apic = 0; apic < nr_ioapics; apic++) {
+    for (apic = 0; apic < nr_ioapics; apic++) {
        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
 
-               /*
-                * add it to the IO-APIC irq-routing table:
-                */
-               memset(&entry,0,sizeof(entry));
-
-               entry.delivery_mode = INT_DELIVERY_MODE;
-               entry.dest_mode = INT_DEST_MODE;
-               entry.mask = 0;                         /* enable IRQ */
-               entry.dest.logical.logical_dest = 
-                                       cpu_mask_to_apicid(TARGET_CPUS);
-
-               idx = find_irq_entry(apic,pin,mp_INT);
-               if (idx == -1) {
-                       if (first_notcon) {
-                               apic_printk(APIC_VERBOSE, KERN_DEBUG
-                                               " IO-APIC (apicid-pin) %d-%d",
-                                               mp_ioapics[apic].mpc_apicid,
-                                               pin);
-                               first_notcon = 0;
-                       } else
-                               apic_printk(APIC_VERBOSE, ", %d-%d",
-                                       mp_ioapics[apic].mpc_apicid, pin);
-                       continue;
-               }
-
-               entry.trigger = irq_trigger(idx);
-               entry.polarity = irq_polarity(idx);
-
-               if (irq_trigger(idx)) {
-                       entry.trigger = 1;
-                       entry.mask = 1;
-               }
-
-               irq = pin_2_irq(idx, apic, pin);
-               /*
-                * skip adding the timer int on secondary nodes, which causes
-                * a small but painful rift in the time-space continuum
-                */
-               if (multi_timer_check(apic, irq))
-                       continue;
-               else
-                       add_pin_to_irq(irq, apic, pin);
-
-               if (!apic && !IO_APIC_IRQ(irq))
-                       continue;
-
-               if (IO_APIC_IRQ(irq)) {
-                       vector = assign_irq_vector(irq);
-                       entry.vector = vector;
-                       ioapic_register_intr(irq, vector, IOAPIC_AUTO);
+            /*
+             * add it to the IO-APIC irq-routing table:
+             */
+            memset(&entry,0,sizeof(entry));
+
+            entry.delivery_mode = INT_DELIVERY_MODE;
+            entry.dest_mode = INT_DEST_MODE;
+            entry.mask = 0;                            /* enable IRQ */
+            entry.dest.logical.logical_dest = 
+                cpu_mask_to_apicid(TARGET_CPUS);
+
+            idx = find_irq_entry(apic,pin,mp_INT);
+            if (idx == -1) {
+                if (first_notcon) {
+                    apic_printk(APIC_VERBOSE, KERN_DEBUG
+                                " IO-APIC (apicid-pin) %d-%d",
+                                mp_ioapics[apic].mpc_apicid,
+                                pin);
+                    first_notcon = 0;
+                } else
+                    apic_printk(APIC_VERBOSE, ", %d-%d",
+                                mp_ioapics[apic].mpc_apicid, pin);
+                continue;
+            }
+
+            entry.trigger = irq_trigger(idx);
+            entry.polarity = irq_polarity(idx);
+
+            if (irq_trigger(idx)) {
+                entry.trigger = 1;
+                entry.mask = 1;
+            }
+
+            irq = pin_2_irq(idx, apic, pin);
+            /*
+             * skip adding the timer int on secondary nodes, which causes
+             * a small but painful rift in the time-space continuum
+             */
+            if (multi_timer_check(apic, irq))
+                continue;
+            else
+                add_pin_to_irq(irq, apic, pin);
+
+            if (!apic && !IO_APIC_IRQ(irq))
+                continue;
+
+            if (IO_APIC_IRQ(irq)) {
+                vector = assign_irq_vector(irq);
+                entry.vector = vector;
+                ioapic_register_intr(irq, vector, IOAPIC_AUTO);
                
-                       if (!apic && (irq < 16))
-                               disable_8259A_irq(irq);
-               }
-               spin_lock_irqsave(&ioapic_lock, flags);
-               io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
-               io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0));
-               spin_unlock_irqrestore(&ioapic_lock, flags);
-       }
+                if (!apic && (irq < 16))
+                    disable_8259A_irq(irq);
+            }
+            spin_lock_irqsave(&ioapic_lock, flags);
+            io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
+            io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0));
+            spin_unlock_irqrestore(&ioapic_lock, flags);
        }
+    }
 
-       if (!first_notcon)
-               apic_printk(APIC_VERBOSE, " not connected.\n");
+    if (!first_notcon)
+        apic_printk(APIC_VERBOSE, " not connected.\n");
 }
 
 /*
@@ -747,43 +699,43 @@ void __init setup_IO_APIC_irqs(void)
  */
 void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
 {
-       struct IO_APIC_route_entry entry;
-       unsigned long flags;
-
-       memset(&entry,0,sizeof(entry));
-
-       disable_8259A_irq(0);
-
-       /* mask LVT0 */
-       apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
-
-       /*
-        * We use logical delivery to get the timer IRQ
-        * to the first CPU.
-        */
-       entry.dest_mode = INT_DEST_MODE;
-       entry.mask = 0;                                 /* unmask IRQ now */
-       entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
-       entry.delivery_mode = INT_DELIVERY_MODE;
-       entry.polarity = 0;
-       entry.trigger = 0;
-       entry.vector = vector;
-
-       /*
-        * The timer IRQ doesn't have to know that behind the
-        * scene we have a 8259A-master in AEOI mode ...
-        */
-       irq_desc[IO_APIC_VECTOR(0)].handler = &ioapic_edge_type;
+    struct IO_APIC_route_entry entry;
+    unsigned long flags;
 
-       /*
-        * Add it to the IO-APIC irq-routing table:
-        */
-       spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1));
-       io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0));
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    memset(&entry,0,sizeof(entry));
+
+    disable_8259A_irq(0);
+
+    /* mask LVT0 */
+    apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
+
+    /*
+     * We use logical delivery to get the timer IRQ
+     * to the first CPU.
+     */
+    entry.dest_mode = INT_DEST_MODE;
+    entry.mask = 0;                                    /* unmask IRQ now */
+    entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
+    entry.delivery_mode = INT_DELIVERY_MODE;
+    entry.polarity = 0;
+    entry.trigger = 0;
+    entry.vector = vector;
+
+    /*
+     * The timer IRQ doesn't have to know that behind the
+     * scene we have a 8259A-master in AEOI mode ...
+     */
+    irq_desc[IO_APIC_VECTOR(0)].handler = &ioapic_edge_type;
+
+    /*
+     * Add it to the IO-APIC irq-routing table:
+     */
+    spin_lock_irqsave(&ioapic_lock, flags);
+    io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1));
+    io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0));
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 
-       enable_8259A_irq(0);
+    enable_8259A_irq(0);
 }
 
 static inline void UNEXPECTED_IO_APIC(void)
@@ -792,36 +744,36 @@ static inline void UNEXPECTED_IO_APIC(void)
 
 void __init print_IO_APIC(void)
 {
-       int apic, i;
-       union IO_APIC_reg_00 reg_00;
-       union IO_APIC_reg_01 reg_01;
-       union IO_APIC_reg_02 reg_02;
-       union IO_APIC_reg_03 reg_03;
-       unsigned long flags;
+    int apic, i;
+    union IO_APIC_reg_00 reg_00;
+    union IO_APIC_reg_01 reg_01;
+    union IO_APIC_reg_02 reg_02;
+    union IO_APIC_reg_03 reg_03;
+    unsigned long flags;
 
-       if (apic_verbosity == APIC_QUIET)
-               return;
+    if (apic_verbosity == APIC_QUIET)
+        return;
 
-       printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
-       for (i = 0; i < nr_ioapics; i++)
-               printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
-                      mp_ioapics[i].mpc_apicid, nr_ioapic_registers[i]);
+    printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
+    for (i = 0; i < nr_ioapics; i++)
+        printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
+               mp_ioapics[i].mpc_apicid, nr_ioapic_registers[i]);
 
-       /*
-        * We are a bit conservative about what we expect.  We have to
-        * know about every hardware change ASAP.
-        */
-       printk(KERN_INFO "testing the IO APIC.......................\n");
+    /*
+     * We are a bit conservative about what we expect.  We have to
+     * know about every hardware change ASAP.
+     */
+    printk(KERN_INFO "testing the IO APIC.......................\n");
 
-       for (apic = 0; apic < nr_ioapics; apic++) {
+    for (apic = 0; apic < nr_ioapics; apic++) {
 
        spin_lock_irqsave(&ioapic_lock, flags);
        reg_00.raw = io_apic_read(apic, 0);
        reg_01.raw = io_apic_read(apic, 1);
        if (reg_01.bits.version >= 0x10)
-               reg_02.raw = io_apic_read(apic, 2);
+            reg_02.raw = io_apic_read(apic, 2);
        if (reg_01.bits.version >= 0x20)
-               reg_03.raw = io_apic_read(apic, 3);
+            reg_03.raw = io_apic_read(apic, 3);
        spin_unlock_irqrestore(&ioapic_lock, flags);
 
        printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mpc_apicid);
@@ -830,9 +782,9 @@ void __init print_IO_APIC(void)
        printk(KERN_DEBUG ".......    : Delivery Type: %X\n", reg_00.bits.delivery_type);
        printk(KERN_DEBUG ".......    : LTS          : %X\n", reg_00.bits.LTS);
        if (reg_00.bits.ID >= get_physical_broadcast())
-               UNEXPECTED_IO_APIC();
+            UNEXPECTED_IO_APIC();
        if (reg_00.bits.__reserved_1 || reg_00.bits.__reserved_2)
-               UNEXPECTED_IO_APIC();
+            UNEXPECTED_IO_APIC();
 
        printk(KERN_DEBUG ".... register #01: %08X\n", reg_01.raw);
        printk(KERN_DEBUG ".......     : max redirection entries: %04X\n", reg_01.bits.entries);
@@ -843,8 +795,8 @@ void __init print_IO_APIC(void)
                (reg_01.bits.entries != 0x22) && /* bigger Xeon boards */
                (reg_01.bits.entries != 0x2E) &&
                (reg_01.bits.entries != 0x3F)
-       )
-               UNEXPECTED_IO_APIC();
+            )
+            UNEXPECTED_IO_APIC();
 
        printk(KERN_DEBUG ".......     : PRQ implemented: %X\n", reg_01.bits.PRQ);
        printk(KERN_DEBUG ".......     : IO APIC version: %04X\n", reg_01.bits.version);
@@ -853,10 +805,10 @@ void __init print_IO_APIC(void)
                (reg_01.bits.version != 0x11) && /* Pentium/Pro IO-APICs */
                (reg_01.bits.version != 0x13) && /* Xeon IO-APICs */
                (reg_01.bits.version != 0x20)    /* Intel P64H (82806 AA) */
-       )
-               UNEXPECTED_IO_APIC();
+            )
+            UNEXPECTED_IO_APIC();
        if (reg_01.bits.__reserved_1 || reg_01.bits.__reserved_2)
-               UNEXPECTED_IO_APIC();
+            UNEXPECTED_IO_APIC();
 
        /*
         * Some Intel chipsets with IO APIC VERSION of 0x1? don't have reg_02,
@@ -864,10 +816,10 @@ void __init print_IO_APIC(void)
         * value, so ignore it if reg_02 == reg_01.
         */
        if (reg_01.bits.version >= 0x10 && reg_02.raw != reg_01.raw) {
-               printk(KERN_DEBUG ".... register #02: %08X\n", reg_02.raw);
-               printk(KERN_DEBUG ".......     : arbitration: %02X\n", reg_02.bits.arbitration);
-               if (reg_02.bits.__reserved_1 || reg_02.bits.__reserved_2)
-                       UNEXPECTED_IO_APIC();
+            printk(KERN_DEBUG ".... register #02: %08X\n", reg_02.raw);
+            printk(KERN_DEBUG ".......     : arbitration: %02X\n", reg_02.bits.arbitration);
+            if (reg_02.bits.__reserved_1 || reg_02.bits.__reserved_2)
+                UNEXPECTED_IO_APIC();
        }
 
        /*
@@ -877,93 +829,89 @@ void __init print_IO_APIC(void)
         */
        if (reg_01.bits.version >= 0x20 && reg_03.raw != reg_02.raw &&
            reg_03.raw != reg_01.raw) {
-               printk(KERN_DEBUG ".... register #03: %08X\n", reg_03.raw);
-               printk(KERN_DEBUG ".......     : Boot DT    : %X\n", reg_03.bits.boot_DT);
-               if (reg_03.bits.__reserved_1)
-                       UNEXPECTED_IO_APIC();
+            printk(KERN_DEBUG ".... register #03: %08X\n", reg_03.raw);
+            printk(KERN_DEBUG ".......     : Boot DT    : %X\n", reg_03.bits.boot_DT);
+            if (reg_03.bits.__reserved_1)
+                UNEXPECTED_IO_APIC();
        }
 
        printk(KERN_DEBUG ".... IRQ redirection table:\n");
 
        printk(KERN_DEBUG " NR Log Phy Mask Trig IRR Pol"
-                         " Stat Dest Deli Vect:   \n");
+               " Stat Dest Deli Vect:   \n");
 
        for (i = 0; i <= reg_01.bits.entries; i++) {
-               struct IO_APIC_route_entry entry;
+            struct IO_APIC_route_entry entry;
 
-               spin_lock_irqsave(&ioapic_lock, flags);
-               *(((int *)&entry)+0) = io_apic_read(apic, 0x10+i*2);
-               *(((int *)&entry)+1) = io_apic_read(apic, 0x11+i*2);
-               spin_unlock_irqrestore(&ioapic_lock, flags);
+            spin_lock_irqsave(&ioapic_lock, flags);
+            *(((int *)&entry)+0) = io_apic_read(apic, 0x10+i*2);
+            *(((int *)&entry)+1) = io_apic_read(apic, 0x11+i*2);
+            spin_unlock_irqrestore(&ioapic_lock, flags);
 
-               printk(KERN_DEBUG " %02x %03X %02X  ",
-                       i,
-                       entry.dest.logical.logical_dest,
-                       entry.dest.physical.physical_dest
+            printk(KERN_DEBUG " %02x %03X %02X  ",
+                   i,
+                   entry.dest.logical.logical_dest,
+                   entry.dest.physical.physical_dest
                );
 
-               printk("%1d    %1d    %1d   %1d   %1d    %1d    %1d    %02X\n",
-                       entry.mask,
-                       entry.trigger,
-                       entry.irr,
-                       entry.polarity,
-                       entry.delivery_status,
-                       entry.dest_mode,
-                       entry.delivery_mode,
-                       entry.vector
+            printk("%1d    %1d    %1d   %1d   %1d    %1d    %1d    %02X\n",
+                   entry.mask,
+                   entry.trigger,
+                   entry.irr,
+                   entry.polarity,
+                   entry.delivery_status,
+                   entry.dest_mode,
+                   entry.delivery_mode,
+                   entry.vector
                );
        }
-       }
-       if (use_pci_vector())
-               printk(KERN_INFO "Using vector-based indexing\n");
-       printk(KERN_DEBUG "IRQ to pin mappings:\n");
-       for (i = 0; i < NR_IRQS; i++) {
-               struct irq_pin_list *entry = irq_2_pin + i;
-               if (entry->pin < 0)
-                       continue;
-               if (use_pci_vector() && !platform_legacy_irq(i))
-                       printk(KERN_DEBUG "IRQ%d ", IO_APIC_VECTOR(i));
-               else
-                       printk(KERN_DEBUG "IRQ%d ", i);
-               for (;;) {
-                       printk("-> %d:%d", entry->apic, entry->pin);
-                       if (!entry->next)
-                               break;
-                       entry = irq_2_pin + entry->next;
-               }
-               printk("\n");
-       }
+    }
+    printk(KERN_INFO "Using vector-based indexing\n");
+    printk(KERN_DEBUG "IRQ to pin mappings:\n");
+    for (i = 0; i < NR_IRQS; i++) {
+        struct irq_pin_list *entry = irq_2_pin + i;
+        if (entry->pin < 0)
+            continue;
+        printk(KERN_DEBUG "IRQ%d ", IO_APIC_VECTOR(i));
+        for (;;) {
+            printk("-> %d:%d", entry->apic, entry->pin);
+            if (!entry->next)
+                break;
+            entry = irq_2_pin + entry->next;
+        }
+        printk("\n");
+    }
 
-       printk(KERN_INFO ".................................... done.\n");
+    printk(KERN_INFO ".................................... done.\n");
 
-       return;
+    return;
 }
 
 static void __init enable_IO_APIC(void)
 {
-       union IO_APIC_reg_01 reg_01;
-       int i;
-       unsigned long flags;
+    union IO_APIC_reg_01 reg_01;
+    int i;
+    unsigned long flags;
 
-       for (i = 0; i < PIN_MAP_SIZE; i++) {
-               irq_2_pin[i].pin = -1;
-               irq_2_pin[i].next = 0;
-       }
+    for (i = 0; i < PIN_MAP_SIZE; i++) {
+        irq_2_pin[i].pin = -1;
+        irq_2_pin[i].next = 0;
+    }
 
-       /*
-        * The number of IO-APIC IRQ registers (== #pins):
-        */
-       for (i = 0; i < nr_ioapics; i++) {
-               spin_lock_irqsave(&ioapic_lock, flags);
-               reg_01.raw = io_apic_read(i, 1);
-               spin_unlock_irqrestore(&ioapic_lock, flags);
-               nr_ioapic_registers[i] = reg_01.bits.entries+1;
-       }
+    /*
+     * The number of IO-APIC IRQ registers (== #pins):
+     */
+    for (i = 0; i < nr_ioapics; i++) {
+        spin_lock_irqsave(&ioapic_lock, flags);
+        reg_01.raw = io_apic_read(i, 1);
+        spin_unlock_irqrestore(&ioapic_lock, flags);
+        nr_ioapic_registers[i] = reg_01.bits.entries+1;
+    }
 
-       /*
-        * Do not trust the IO-APIC being empty at bootup
-        */
-       clear_IO_APIC();
+    /*
+     * Do not trust the IO-APIC being empty at bootup
+     */
+    clear_IO_APIC();
 }
 
 /*
@@ -971,12 +919,12 @@ static void __init enable_IO_APIC(void)
  */
 void disable_IO_APIC(void)
 {
-       /*
-        * Clear the IO-APIC before rebooting:
+    /*
+     * Clear the IO-APIC before rebooting:
         */
-       clear_IO_APIC();
+    clear_IO_APIC();
 
-       disconnect_bsp_APIC();
+    disconnect_bsp_APIC();
 }
 
 /*
@@ -989,105 +937,105 @@ void disable_IO_APIC(void)
 #ifndef CONFIG_X86_NUMAQ
 static void __init setup_ioapic_ids_from_mpc(void)
 {
-       union IO_APIC_reg_00 reg_00;
-       physid_mask_t phys_id_present_map;
-       int apic;
-       int i;
-       unsigned char old_id;
-       unsigned long flags;
+    union IO_APIC_reg_00 reg_00;
+    physid_mask_t phys_id_present_map;
+    int apic;
+    int i;
+    unsigned char old_id;
+    unsigned long flags;
 
-       /*
-        * This is broken; anything with a real cpu count has to
-        * circumvent this idiocy regardless.
-        */
-       phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map);
+    /*
+     * This is broken; anything with a real cpu count has to
+     * circumvent this idiocy regardless.
+     */
+    phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map);
+
+    /*
+     * Set the IOAPIC ID to the value stored in the MPC table.
+     */
+    for (apic = 0; apic < nr_ioapics; apic++) {
+
+        /* Read the register 0 value */
+        spin_lock_irqsave(&ioapic_lock, flags);
+        reg_00.raw = io_apic_read(apic, 0);
+        spin_unlock_irqrestore(&ioapic_lock, flags);
+               
+        old_id = mp_ioapics[apic].mpc_apicid;
+
+        if (mp_ioapics[apic].mpc_apicid >= get_physical_broadcast()) {
+            printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
+                   apic, mp_ioapics[apic].mpc_apicid);
+            printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
+                   reg_00.bits.ID);
+            mp_ioapics[apic].mpc_apicid = reg_00.bits.ID;
+        }
 
-       /*
-        * Set the IOAPIC ID to the value stored in the MPC table.
-        */
-       for (apic = 0; apic < nr_ioapics; apic++) {
+        /* Don't check I/O APIC IDs for some xAPIC systems.  They have
+         * no meaning without the serial APIC bus. */
+        if (NO_IOAPIC_CHECK)
+            continue;
+        /*
+         * Sanity check, is the ID really free? Every APIC in a
+         * system must have a unique ID or we get lots of nice
+         * 'stuck on smp_invalidate_needed IPI wait' messages.
+         */
+        if (check_apicid_used(phys_id_present_map,
+                              mp_ioapics[apic].mpc_apicid)) {
+            printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
+                   apic, mp_ioapics[apic].mpc_apicid);
+            for (i = 0; i < get_physical_broadcast(); i++)
+                if (!physid_isset(i, phys_id_present_map))
+                    break;
+            if (i >= get_physical_broadcast())
+                panic("Max APIC ID exceeded!\n");
+            printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
+                   i);
+            physid_set(i, phys_id_present_map);
+            mp_ioapics[apic].mpc_apicid = i;
+        } else {
+            physid_mask_t tmp;
+            tmp = apicid_to_cpu_present(mp_ioapics[apic].mpc_apicid);
+            apic_printk(APIC_VERBOSE, "Setting %d in the "
+                        "phys_id_present_map\n",
+                        mp_ioapics[apic].mpc_apicid);
+            physids_or(phys_id_present_map, phys_id_present_map, tmp);
+        }
 
-               /* Read the register 0 value */
-               spin_lock_irqsave(&ioapic_lock, flags);
-               reg_00.raw = io_apic_read(apic, 0);
-               spin_unlock_irqrestore(&ioapic_lock, flags);
-               
-               old_id = mp_ioapics[apic].mpc_apicid;
-
-               if (mp_ioapics[apic].mpc_apicid >= get_physical_broadcast()) {
-                       printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
-                               apic, mp_ioapics[apic].mpc_apicid);
-                       printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
-                               reg_00.bits.ID);
-                       mp_ioapics[apic].mpc_apicid = reg_00.bits.ID;
-               }
-
-               /* Don't check I/O APIC IDs for some xAPIC systems.  They have
-                * no meaning without the serial APIC bus. */
-               if (NO_IOAPIC_CHECK)
-                       continue;
-               /*
-                * Sanity check, is the ID really free? Every APIC in a
-                * system must have a unique ID or we get lots of nice
-                * 'stuck on smp_invalidate_needed IPI wait' messages.
-                */
-               if (check_apicid_used(phys_id_present_map,
-                                       mp_ioapics[apic].mpc_apicid)) {
-                       printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
-                               apic, mp_ioapics[apic].mpc_apicid);
-                       for (i = 0; i < get_physical_broadcast(); i++)
-                               if (!physid_isset(i, phys_id_present_map))
-                                       break;
-                       if (i >= get_physical_broadcast())
-                               panic("Max APIC ID exceeded!\n");
-                       printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
-                               i);
-                       physid_set(i, phys_id_present_map);
-                       mp_ioapics[apic].mpc_apicid = i;
-               } else {
-                       physid_mask_t tmp;
-                       tmp = apicid_to_cpu_present(mp_ioapics[apic].mpc_apicid);
-                       apic_printk(APIC_VERBOSE, "Setting %d in the "
-                                       "phys_id_present_map\n",
-                                       mp_ioapics[apic].mpc_apicid);
-                       physids_or(phys_id_present_map, phys_id_present_map, tmp);
-               }
-
-
-               /*
-                * We need to adjust the IRQ routing table
-                * if the ID changed.
-                */
-               if (old_id != mp_ioapics[apic].mpc_apicid)
-                       for (i = 0; i < mp_irq_entries; i++)
-                               if (mp_irqs[i].mpc_dstapic == old_id)
-                                       mp_irqs[i].mpc_dstapic
-                                               = mp_ioapics[apic].mpc_apicid;
-
-               /*
-                * Read the right value from the MPC table and
-                * write it into the ID register.
-                */
-               apic_printk(APIC_VERBOSE, KERN_INFO
-                       "...changing IO-APIC physical APIC ID to %d ...",
-                       mp_ioapics[apic].mpc_apicid);
-
-               reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
-               spin_lock_irqsave(&ioapic_lock, flags);
-               io_apic_write(apic, 0, reg_00.raw);
-               spin_unlock_irqrestore(&ioapic_lock, flags);
-
-               /*
-                * Sanity check
-                */
-               spin_lock_irqsave(&ioapic_lock, flags);
-               reg_00.raw = io_apic_read(apic, 0);
-               spin_unlock_irqrestore(&ioapic_lock, flags);
-               if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid)
-                       printk("could not set ID!\n");
-               else
-                       apic_printk(APIC_VERBOSE, " ok.\n");
-       }
+
+        /*
+         * We need to adjust the IRQ routing table
+         * if the ID changed.
+         */
+        if (old_id != mp_ioapics[apic].mpc_apicid)
+            for (i = 0; i < mp_irq_entries; i++)
+                if (mp_irqs[i].mpc_dstapic == old_id)
+                    mp_irqs[i].mpc_dstapic
+                        = mp_ioapics[apic].mpc_apicid;
+
+        /*
+         * Read the right value from the MPC table and
+         * write it into the ID register.
+         */
+        apic_printk(APIC_VERBOSE, KERN_INFO
+                    "...changing IO-APIC physical APIC ID to %d ...",
+                    mp_ioapics[apic].mpc_apicid);
+
+        reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
+        spin_lock_irqsave(&ioapic_lock, flags);
+        io_apic_write(apic, 0, reg_00.raw);
+        spin_unlock_irqrestore(&ioapic_lock, flags);
+
+        /*
+         * Sanity check
+         */
+        spin_lock_irqsave(&ioapic_lock, flags);
+        reg_00.raw = io_apic_read(apic, 0);
+        spin_unlock_irqrestore(&ioapic_lock, flags);
+        if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid)
+            printk("could not set ID!\n");
+        else
+            apic_printk(APIC_VERBOSE, " ok.\n");
+    }
 }
 #else
 static void __init setup_ioapic_ids_from_mpc(void) { }
@@ -1103,23 +1051,23 @@ static void __init setup_ioapic_ids_from_mpc(void) { }
  */
 static int __init timer_irq_works(void)
 {
-       unsigned long t1 = jiffies;
-
-       local_irq_enable();
-       /* Let ten ticks pass... */
-       mdelay((10 * 1000) / HZ);
+    unsigned long t1 = jiffies;
+
+    local_irq_enable();
+    /* Let ten ticks pass... */
+    mdelay((10 * 1000) / HZ);
+
+    /*
+     * Expect a few ticks at least, to be sure some possible
+     * glue logic does not lock up after one or two first
+     * ticks in a non-ExtINT mode.  Also the local APIC
+     * might have cached one ExtINT interrupt.  Finally, at
+     * least one tick may be lost due to delays.
+     */
+    if (jiffies - t1 > 4)
+        return 1;
 
-       /*
-        * Expect a few ticks at least, to be sure some possible
-        * glue logic does not lock up after one or two first
-        * ticks in a non-ExtINT mode.  Also the local APIC
-        * might have cached one ExtINT interrupt.  Finally, at
-        * least one tick may be lost due to delays.
-        */
-       if (jiffies - t1 > 4)
-               return 1;
-
-       return 0;
+    return 0;
 }
 
 /*
@@ -1146,19 +1094,19 @@ static int __init timer_irq_works(void)
  */
 static unsigned int startup_edge_ioapic_irq(unsigned int irq)
 {
-       int was_pending = 0;
-       unsigned long flags;
+    int was_pending = 0;
+    unsigned long flags;
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       if (irq < 16) {
-               disable_8259A_irq(irq);
-               if (i8259A_irq_pending(irq))
-                       was_pending = 1;
-       }
-       __unmask_IO_APIC_irq(irq);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    if (irq < 16) {
+        disable_8259A_irq(irq);
+        if (i8259A_irq_pending(irq))
+            was_pending = 1;
+    }
+    __unmask_IO_APIC_irq(irq);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 
-       return was_pending;
+    return was_pending;
 }
 
 /*
@@ -1168,10 +1116,10 @@ static unsigned int startup_edge_ioapic_irq(unsigned int irq)
  */
 static void ack_edge_ioapic_irq(unsigned int irq)
 {
-       if ((irq_desc[IO_APIC_VECTOR(irq)].status & (IRQ_PENDING | IRQ_DISABLED))
-                                       == (IRQ_PENDING | IRQ_DISABLED))
-               mask_IO_APIC_irq(irq);
-       ack_APIC_irq();
+    if ((irq_desc[IO_APIC_VECTOR(irq)].status & (IRQ_PENDING | IRQ_DISABLED))
+        == (IRQ_PENDING | IRQ_DISABLED))
+        mask_IO_APIC_irq(irq);
+    ack_APIC_irq();
 }
 
 /*
@@ -1190,17 +1138,17 @@ static void ack_edge_ioapic_irq(unsigned int irq)
  */
 static unsigned int startup_level_ioapic_irq (unsigned int irq)
 {
-       unmask_IO_APIC_irq(irq);
+    unmask_IO_APIC_irq(irq);
 
-       return 0; /* don't check for pending */
+    return 0; /* don't check for pending */
 }
 
 static void mask_and_ack_level_ioapic_irq (unsigned int irq)
 {
-       unsigned long v;
-       int i;
+    unsigned long v;
+    int i;
 
-       mask_IO_APIC_irq(irq);
+    mask_IO_APIC_irq(irq);
 /*
  * It appears there is an erratum which affects at least version 0x11
  * of I/O APIC (that's the 82093AA and cores integrated into various
@@ -1220,84 +1168,82 @@ static void mask_and_ack_level_ioapic_irq (unsigned int irq)
  * operation to prevent an edge-triggered interrupt escaping meanwhile.
  * The idea is from Manfred Spraul.  --macro
  */
-       i = IO_APIC_VECTOR(irq);
+    i = IO_APIC_VECTOR(irq);
 
-       v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
+    v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
 
-       ack_APIC_irq();
+    ack_APIC_irq();
 
-       if (!(v & (1 << (i & 0x1f)))) {
-               atomic_inc(&irq_mis_count);
-               spin_lock(&ioapic_lock);
-               __edge_IO_APIC_irq(irq);
-               __level_IO_APIC_irq(irq);
-               spin_unlock(&ioapic_lock);
-       }
+    if (!(v & (1 << (i & 0x1f)))) {
+        atomic_inc(&irq_mis_count);
+        spin_lock(&ioapic_lock);
+        __edge_IO_APIC_irq(irq);
+        __level_IO_APIC_irq(irq);
+        spin_unlock(&ioapic_lock);
+    }
 }
 
 static void end_level_ioapic_irq (unsigned int irq)
 {
-       unmask_IO_APIC_irq(irq);
+    unmask_IO_APIC_irq(irq);
 }
 
-#ifdef CONFIG_PCI_MSI
 static unsigned int startup_edge_ioapic_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
-
-       return startup_edge_ioapic_irq(irq);
+    int irq = vector_to_irq(vector);
+    return startup_edge_ioapic_irq(irq);
 }
 
 static void ack_edge_ioapic_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
-
-       ack_edge_ioapic_irq(irq);
+    int irq = vector_to_irq(vector);
+    ack_edge_ioapic_irq(irq);
 }
 
-static unsigned int startup_level_ioapic_vector (unsigned int vector)
+static unsigned int startup_level_ioapic_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
-
-       return startup_level_ioapic_irq (irq);
+    int irq = vector_to_irq(vector);
+    return startup_level_ioapic_irq (irq);
 }
 
-static void mask_and_ack_level_ioapic_vector (unsigned int vector)
+static void mask_and_ack_level_ioapic_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
-
-       mask_and_ack_level_ioapic_irq(irq);
+    int irq = vector_to_irq(vector);
+    mask_and_ack_level_ioapic_irq(irq);
 }
 
-static void end_level_ioapic_vector (unsigned int vector)
+static void end_level_ioapic_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
-
-       end_level_ioapic_irq(irq);
+    int irq = vector_to_irq(vector);
+    end_level_ioapic_irq(irq);
 }
 
-static void mask_IO_APIC_vector (unsigned int vector)
+static void mask_IO_APIC_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
-
-       mask_IO_APIC_irq(irq);
+    int irq = vector_to_irq(vector);
+    mask_IO_APIC_irq(irq);
 }
 
-static void unmask_IO_APIC_vector (unsigned int vector)
+static void unmask_IO_APIC_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
+    int irq = vector_to_irq(vector);
+    unmask_IO_APIC_irq(irq);
+}
 
-       unmask_IO_APIC_irq(irq);
+static void set_ioapic_affinity_vector(
+    unsigned int vector, cpumask_t cpu_mask)
+{
+    int irq = vector_to_irq(vector);
+    set_ioapic_affinity_irq(irq, cpu_mask);
 }
 
-static void set_ioapic_affinity_vector (unsigned int vector,
-                                       cpumask_t cpu_mask)
+static void disable_edge_ioapic_vector(unsigned int vector)
 {
-       int irq = vector_to_irq(vector);
+}
 
-       set_ioapic_affinity_irq(irq, cpu_mask);
+static void end_edge_ioapic_vector(unsigned int vector)
+{
 }
-#endif
 
 /*
  * Level and edge triggered IO-APIC interrupts need different handling,
@@ -1308,94 +1254,66 @@ static void set_ioapic_affinity_vector (unsigned int vector,
  * races.
  */
 static struct hw_interrupt_type ioapic_edge_type = {
-       .typename       = "IO-APIC-edge",
-       .startup        = startup_edge_ioapic,
-       .shutdown       = shutdown_edge_ioapic,
-       .enable         = enable_edge_ioapic,
-       .disable        = disable_edge_ioapic,
-       .ack            = ack_edge_ioapic,
-       .end            = end_edge_ioapic,
-       .set_affinity   = set_ioapic_affinity,
+    .typename  = "IO-APIC-edge",
+    .startup   = startup_edge_ioapic_vector,
+    .shutdown  = disable_edge_ioapic_vector,
+    .enable    = unmask_IO_APIC_vector,
+    .disable   = disable_edge_ioapic_vector,
+    .ack               = ack_edge_ioapic_vector,
+    .end               = end_edge_ioapic_vector,
+    .set_affinity      = set_ioapic_affinity_vector,
 };
 
 static struct hw_interrupt_type ioapic_level_type = {
-       .typename       = "IO-APIC-level",
-       .startup        = startup_level_ioapic,
-       .shutdown       = shutdown_level_ioapic,
-       .enable         = enable_level_ioapic,
-       .disable        = disable_level_ioapic,
-       .ack            = mask_and_ack_level_ioapic,
-       .end            = end_level_ioapic,
-       .set_affinity   = set_ioapic_affinity,
+    .typename  = "IO-APIC-level",
+    .startup   = startup_level_ioapic_vector,
+    .shutdown  = mask_IO_APIC_vector,
+    .enable    = unmask_IO_APIC_vector,
+    .disable   = mask_IO_APIC_vector,
+    .ack               = mask_and_ack_level_ioapic_vector,
+    .end               = end_level_ioapic_vector,
+    .set_affinity      = set_ioapic_affinity_vector,
 };
 
 static inline void init_IO_APIC_traps(void)
 {
-       int irq;
-
-       /*
-        * NOTE! The local APIC isn't very good at handling
-        * multiple interrupts at the same interrupt level.
-        * As the interrupt level is determined by taking the
-        * vector number and shifting that right by 4, we
-        * want to spread these out a bit so that they don't
-        * all fall in the same interrupt level.
-        *
-        * Also, we've got to be careful not to trash gate
-        * 0x80, because int 0x80 is hm, kind of importantish. ;)
-        */
-       for (irq = 0; irq < NR_IRQS ; irq++) {
-               int tmp = irq;
-#if 0
-               if (use_pci_vector()) {
-                       if (!platform_legacy_irq(tmp))
-                               if ((tmp = vector_to_irq(tmp)) == -1)
-                                       continue;
-               }
-#endif
-               if (IO_APIC_IRQ(tmp) && !IO_APIC_VECTOR(tmp)) {
-                       /*
-                        * Hmm.. We don't have an entry for this,
-                        * so default to an old-fashioned 8259
-                        * interrupt if we can..
-                        */
-                       if (irq < 16)
-                               make_8259A_irq(irq);
-               }
-       }
+    int irq;
+    for (irq = 0; irq < NR_IRQS ; irq++)
+        if (IO_APIC_IRQ(irq) && !IO_APIC_VECTOR(irq) && (irq < 16))
+            make_8259A_irq(irq);
 }
 
-static void enable_lapic_irq (unsigned int irq)
+static void enable_lapic_vector(unsigned int vector)
 {
-       unsigned long v;
+    unsigned long v;
 
-       v = apic_read(APIC_LVT0);
-       apic_write_around(APIC_LVT0, v & ~APIC_LVT_MASKED);
+    v = apic_read(APIC_LVT0);
+    apic_write_around(APIC_LVT0, v & ~APIC_LVT_MASKED);
 }
 
-static void disable_lapic_irq (unsigned int irq)
+static void disable_lapic_vector(unsigned int vector)
 {
-       unsigned long v;
+    unsigned long v;
 
-       v = apic_read(APIC_LVT0);
-       apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED);
+    v = apic_read(APIC_LVT0);
+    apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED);
 }
 
-static void ack_lapic_irq (unsigned int irq)
+static void ack_lapic_vector(unsigned int vector)
 {
-       ack_APIC_irq();
+    ack_APIC_irq();
 }
 
-static void end_lapic_irq (unsigned int i) { /* nothing */ }
+static void end_lapic_vector(unsigned int vector) { /* nothing */ }
 
 static struct hw_interrupt_type lapic_irq_type = {
-       .typename       = "local-APIC-edge",
-       .startup        = NULL, /* startup_irq() not used for IRQ0 */
-       .shutdown       = NULL, /* shutdown_irq() not used for IRQ0 */
-       .enable         = enable_lapic_irq,
-       .disable        = disable_lapic_irq,
-       .ack            = ack_lapic_irq,
-       .end            = end_lapic_irq
+    .typename  = "local-APIC-edge",
+    .startup   = NULL, /* startup_irq() not used for IRQ0 */
+    .shutdown  = NULL, /* shutdown_irq() not used for IRQ0 */
+    .enable    = enable_lapic_vector,
+    .disable   = disable_lapic_vector,
+    .ack               = ack_lapic_vector,
+    .end               = end_lapic_vector
 };
 
 /*
@@ -1407,57 +1325,57 @@ static struct hw_interrupt_type lapic_irq_type = {
  */
 static inline void unlock_ExtINT_logic(void)
 {
-       int pin, i;
-       struct IO_APIC_route_entry entry0, entry1;
-       unsigned char save_control, save_freq_select;
-       unsigned long flags;
+    int pin, i;
+    struct IO_APIC_route_entry entry0, entry1;
+    unsigned char save_control, save_freq_select;
+    unsigned long flags;
 
-       pin = find_isa_irq_pin(8, mp_INT);
-       if (pin == -1)
-               return;
+    pin = find_isa_irq_pin(8, mp_INT);
+    if (pin == -1)
+        return;
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       *(((int *)&entry0) + 1) = io_apic_read(0, 0x11 + 2 * pin);
-       *(((int *)&entry0) + 0) = io_apic_read(0, 0x10 + 2 * pin);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
-       clear_IO_APIC_pin(0, pin);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    *(((int *)&entry0) + 1) = io_apic_read(0, 0x11 + 2 * pin);
+    *(((int *)&entry0) + 0) = io_apic_read(0, 0x10 + 2 * pin);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
+    clear_IO_APIC_pin(0, pin);
 
-       memset(&entry1, 0, sizeof(entry1));
+    memset(&entry1, 0, sizeof(entry1));
 
-       entry1.dest_mode = 0;                   /* physical delivery */
-       entry1.mask = 0;                        /* unmask IRQ now */
-       entry1.dest.physical.physical_dest = hard_smp_processor_id();
-       entry1.delivery_mode = dest_ExtINT;
-       entry1.polarity = entry0.polarity;
-       entry1.trigger = 0;
-       entry1.vector = 0;
+    entry1.dest_mode = 0;                      /* physical delivery */
+    entry1.mask = 0;                   /* unmask IRQ now */
+    entry1.dest.physical.physical_dest = hard_smp_processor_id();
+    entry1.delivery_mode = dest_ExtINT;
+    entry1.polarity = entry0.polarity;
+    entry1.trigger = 0;
+    entry1.vector = 0;
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry1) + 1));
-       io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry1) + 0));
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry1) + 1));
+    io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry1) + 0));
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 
-       save_control = CMOS_READ(RTC_CONTROL);
-       save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
-       CMOS_WRITE((save_freq_select & ~RTC_RATE_SELECT) | 0x6,
-                  RTC_FREQ_SELECT);
-       CMOS_WRITE(save_control | RTC_PIE, RTC_CONTROL);
-
-       i = 100;
-       while (i-- > 0) {
-               mdelay(10);
-               if ((CMOS_READ(RTC_INTR_FLAGS) & RTC_PF) == RTC_PF)
-                       i -= 10;
-       }
+    save_control = CMOS_READ(RTC_CONTROL);
+    save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
+    CMOS_WRITE((save_freq_select & ~RTC_RATE_SELECT) | 0x6,
+               RTC_FREQ_SELECT);
+    CMOS_WRITE(save_control | RTC_PIE, RTC_CONTROL);
+
+    i = 100;
+    while (i-- > 0) {
+        mdelay(10);
+        if ((CMOS_READ(RTC_INTR_FLAGS) & RTC_PF) == RTC_PF)
+            i -= 10;
+    }
 
-       CMOS_WRITE(save_control, RTC_CONTROL);
-       CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
-       clear_IO_APIC_pin(0, pin);
+    CMOS_WRITE(save_control, RTC_CONTROL);
+    CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
+    clear_IO_APIC_pin(0, pin);
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry0) + 1));
-       io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry0) + 1));
+    io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
 /*
@@ -1468,105 +1386,105 @@ static inline void unlock_ExtINT_logic(void)
  */
 static inline void check_timer(void)
 {
-       int pin1, pin2;
-       int vector;
-
-       /*
-        * get/set the timer IRQ vector:
-        */
-       disable_8259A_irq(0);
-       vector = assign_irq_vector(0);
-
-        irq_desc[IO_APIC_VECTOR(0)].action = irq_desc[LEGACY_VECTOR(0)].action;
-        irq_desc[IO_APIC_VECTOR(0)].depth  = 0;
-        irq_desc[IO_APIC_VECTOR(0)].status &= ~IRQ_DISABLED;
-
-       /*
-        * Subtle, code in do_timer_interrupt() expects an AEOI
-        * mode for the 8259A whenever interrupts are routed
-        * through I/O APICs.  Also IRQ0 has to be enabled in
-        * the 8259A which implies the virtual wire has to be
-        * disabled in the local APIC.
-        */
-       apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
-       init_8259A(1);
-       timer_ack = 1;
-       enable_8259A_irq(0);
-
-       pin1 = find_isa_irq_pin(0, mp_INT);
-       pin2 = find_isa_irq_pin(0, mp_ExtINT);
-
-       printk(KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2);
-
-       if (pin1 != -1) {
-               /*
-                * Ok, does IRQ0 through the IOAPIC work?
-                */
-               unmask_IO_APIC_irq(0);
-               if (timer_irq_works()) {
-                       return;
-               }
-               clear_IO_APIC_pin(0, pin1);
-               printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n");
-       }
+    int pin1, pin2;
+    int vector;
+
+    /*
+     * get/set the timer IRQ vector:
+     */
+    disable_8259A_irq(0);
+    vector = assign_irq_vector(0);
+
+    irq_desc[IO_APIC_VECTOR(0)].action = irq_desc[LEGACY_VECTOR(0)].action;
+    irq_desc[IO_APIC_VECTOR(0)].depth  = 0;
+    irq_desc[IO_APIC_VECTOR(0)].status &= ~IRQ_DISABLED;
+
+    /*
+     * Subtle, code in do_timer_interrupt() expects an AEOI
+     * mode for the 8259A whenever interrupts are routed
+     * through I/O APICs.  Also IRQ0 has to be enabled in
+     * the 8259A which implies the virtual wire has to be
+     * disabled in the local APIC.
+     */
+    apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
+    init_8259A(1);
+    timer_ack = 1;
+    enable_8259A_irq(0);
+
+    pin1 = find_isa_irq_pin(0, mp_INT);
+    pin2 = find_isa_irq_pin(0, mp_ExtINT);
+
+    printk(KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2);
+
+    if (pin1 != -1) {
+        /*
+         * Ok, does IRQ0 through the IOAPIC work?
+         */
+        unmask_IO_APIC_irq(0);
+        if (timer_irq_works()) {
+            return;
+        }
+        clear_IO_APIC_pin(0, pin1);
+        printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n");
+    }
 
-       printk(KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... ");
-       if (pin2 != -1) {
-               printk("\n..... (found pin %d) ...", pin2);
-               /*
-                * legacy devices should be connected to IO APIC #0
-                */
-               setup_ExtINT_IRQ0_pin(pin2, vector);
-               if (timer_irq_works()) {
-                       printk("works.\n");
-                       if (pin1 != -1)
-                               replace_pin_at_irq(0, 0, pin1, 0, pin2);
-                       else
-                               add_pin_to_irq(0, 0, pin2);
-                       return;
-               }
-               /*
-                * Cleanup, just in case ...
-                */
-               clear_IO_APIC_pin(0, pin2);
-       }
-       printk(" failed.\n");
+    printk(KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... ");
+    if (pin2 != -1) {
+        printk("\n..... (found pin %d) ...", pin2);
+        /*
+         * legacy devices should be connected to IO APIC #0
+         */
+        setup_ExtINT_IRQ0_pin(pin2, vector);
+        if (timer_irq_works()) {
+            printk("works.\n");
+            if (pin1 != -1)
+                replace_pin_at_irq(0, 0, pin1, 0, pin2);
+            else
+                add_pin_to_irq(0, 0, pin2);
+            return;
+        }
+        /*
+         * Cleanup, just in case ...
+         */
+        clear_IO_APIC_pin(0, pin2);
+    }
+    printk(" failed.\n");
 
-       if (nmi_watchdog == NMI_IO_APIC) {
-               printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
-               nmi_watchdog = 0;
-       }
+    if (nmi_watchdog == NMI_IO_APIC) {
+        printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
+        nmi_watchdog = 0;
+    }
 
-       printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
+    printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
 
-       disable_8259A_irq(0);
-       irq_desc[vector].handler = &lapic_irq_type;
-       apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector);   /* Fixed mode */
-       enable_8259A_irq(0);
+    disable_8259A_irq(0);
+    irq_desc[vector].handler = &lapic_irq_type;
+    apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector);      /* Fixed mode */
+    enable_8259A_irq(0);
 
-       if (timer_irq_works()) {
-               printk(" works.\n");
-               return;
-       }
-       apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
-       printk(" failed.\n");
+    if (timer_irq_works()) {
+        printk(" works.\n");
+        return;
+    }
+    apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
+    printk(" failed.\n");
 
-       printk(KERN_INFO "...trying to set up timer as ExtINT IRQ...");
+    printk(KERN_INFO "...trying to set up timer as ExtINT IRQ...");
 
-       timer_ack = 0;
-       init_8259A(0);
-       make_8259A_irq(0);
-       apic_write_around(APIC_LVT0, APIC_DM_EXTINT);
+    timer_ack = 0;
+    init_8259A(0);
+    make_8259A_irq(0);
+    apic_write_around(APIC_LVT0, APIC_DM_EXTINT);
 
-       unlock_ExtINT_logic();
+    unlock_ExtINT_logic();
 
-       if (timer_irq_works()) {
-               printk(" works.\n");
-               return;
-       }
-       printk(" failed :(.\n");
-       panic("IO-APIC + timer doesn't work!  Boot with apic=debug and send a "
-               "report.  Then try booting with the 'noapic' option");
+    if (timer_irq_works()) {
+        printk(" works.\n");
+        return;
+    }
+    printk(" failed :(.\n");
+    panic("IO-APIC + timer doesn't work!  Boot with apic=debug and send a "
+          "report.  Then try booting with the 'noapic' option");
 }
 
 #define NR_IOAPIC_BIOSIDS 256
@@ -1590,27 +1508,27 @@ static void store_ioapic_biosid_mapping(void)
 
 void __init setup_IO_APIC(void)
 {
-       store_ioapic_biosid_mapping();
-
-       enable_IO_APIC();
-
-       if (acpi_ioapic)
-               io_apic_irqs = ~0;      /* all IRQs go through IOAPIC */
-       else
-               io_apic_irqs = ~PIC_IRQS;
-
-       printk("ENABLING IO-APIC IRQs\n");
-
-       /*
-        * Set up IO-APIC IRQ routing.
-        */
-       if (!acpi_ioapic)
-               setup_ioapic_ids_from_mpc();
-       sync_Arb_IDs();
-       setup_IO_APIC_irqs();
-       init_IO_APIC_traps();
-       check_timer();
-       print_IO_APIC();
+    store_ioapic_biosid_mapping();
+
+    enable_IO_APIC();
+
+    if (acpi_ioapic)
+        io_apic_irqs = ~0;     /* all IRQs go through IOAPIC */
+    else
+        io_apic_irqs = ~PIC_IRQS;
+
+    printk("ENABLING IO-APIC IRQs\n");
+
+    /*
+     * Set up IO-APIC IRQ routing.
+     */
+    if (!acpi_ioapic)
+        setup_ioapic_ids_from_mpc();
+    sync_Arb_IDs();
+    setup_IO_APIC_irqs();
+    init_IO_APIC_traps();
+    check_timer();
+    print_IO_APIC();
 }
 
 /* --------------------------------------------------------------------------
@@ -1621,153 +1539,153 @@ void __init setup_IO_APIC(void)
 
 int __init io_apic_get_unique_id (int ioapic, int apic_id)
 {
-       union IO_APIC_reg_00 reg_00;
-       static physid_mask_t apic_id_map = PHYSID_MASK_NONE;
-       physid_mask_t tmp;
-       unsigned long flags;
-       int i = 0;
+    union IO_APIC_reg_00 reg_00;
+    static physid_mask_t apic_id_map = PHYSID_MASK_NONE;
+    physid_mask_t tmp;
+    unsigned long flags;
+    int i = 0;
 
-       /*
-        * The P4 platform supports up to 256 APIC IDs on two separate APIC 
-        * buses (one for LAPICs, one for IOAPICs), where predecessors only 
-        * supports up to 16 on one shared APIC bus.
-        
-        * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
-        *      advantage of new APIC bus architecture.
-        */
+    /*
+     * The P4 platform supports up to 256 APIC IDs on two separate APIC 
+     * buses (one for LAPICs, one for IOAPICs), where predecessors only 
+     * supports up to 16 on one shared APIC bus.
+     * 
+     * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
+     *      advantage of new APIC bus architecture.
+     */
 
-       if (physids_empty(apic_id_map))
-               apic_id_map = ioapic_phys_id_map(phys_cpu_present_map);
+    if (physids_empty(apic_id_map))
+        apic_id_map = ioapic_phys_id_map(phys_cpu_present_map);
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       reg_00.raw = io_apic_read(ioapic, 0);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    reg_00.raw = io_apic_read(ioapic, 0);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 
-       if (apic_id >= get_physical_broadcast()) {
-               printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
-                       "%d\n", ioapic, apic_id, reg_00.bits.ID);
-               apic_id = reg_00.bits.ID;
-       }
+    if (apic_id >= get_physical_broadcast()) {
+        printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
+               "%d\n", ioapic, apic_id, reg_00.bits.ID);
+        apic_id = reg_00.bits.ID;
+    }
 
-       /*
-        * Every APIC in a system must have a unique ID or we get lots of nice 
-        * 'stuck on smp_invalidate_needed IPI wait' messages.
-        */
-       if (check_apicid_used(apic_id_map, apic_id)) {
+    /*
+     * Every APIC in a system must have a unique ID or we get lots of nice 
+     * 'stuck on smp_invalidate_needed IPI wait' messages.
+     */
+    if (check_apicid_used(apic_id_map, apic_id)) {
 
-               for (i = 0; i < get_physical_broadcast(); i++) {
-                       if (!check_apicid_used(apic_id_map, i))
-                               break;
-               }
+        for (i = 0; i < get_physical_broadcast(); i++) {
+            if (!check_apicid_used(apic_id_map, i))
+                break;
+        }
 
-               if (i == get_physical_broadcast())
-                       panic("Max apic_id exceeded!\n");
+        if (i == get_physical_broadcast())
+            panic("Max apic_id exceeded!\n");
 
-               printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
-                       "trying %d\n", ioapic, apic_id, i);
+        printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
+               "trying %d\n", ioapic, apic_id, i);
 
-               apic_id = i;
-       
+        apic_id = i;
+    } 
 
-       tmp = apicid_to_cpu_present(apic_id);
-       physids_or(apic_id_map, apic_id_map, tmp);
+    tmp = apicid_to_cpu_present(apic_id);
+    physids_or(apic_id_map, apic_id_map, tmp);
 
-       if (reg_00.bits.ID != apic_id) {
-               reg_00.bits.ID = apic_id;
+    if (reg_00.bits.ID != apic_id) {
+        reg_00.bits.ID = apic_id;
 
-               spin_lock_irqsave(&ioapic_lock, flags);
-               io_apic_write(ioapic, 0, reg_00.raw);
-               reg_00.raw = io_apic_read(ioapic, 0);
-               spin_unlock_irqrestore(&ioapic_lock, flags);
+        spin_lock_irqsave(&ioapic_lock, flags);
+        io_apic_write(ioapic, 0, reg_00.raw);
+        reg_00.raw = io_apic_read(ioapic, 0);
+        spin_unlock_irqrestore(&ioapic_lock, flags);
 
-               /* Sanity check */
-               if (reg_00.bits.ID != apic_id)
-                       panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic);
-       }
+        /* Sanity check */
+        if (reg_00.bits.ID != apic_id)
+            panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic);
+    }
 
-       apic_printk(APIC_VERBOSE, KERN_INFO
-                       "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
+    apic_printk(APIC_VERBOSE, KERN_INFO
+                "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
 
-       return apic_id;
+    return apic_id;
 }
 
 
 int __init io_apic_get_version (int ioapic)
 {
-       union IO_APIC_reg_01    reg_01;
-       unsigned long flags;
+    union IO_APIC_reg_01       reg_01;
+    unsigned long flags;
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       reg_01.raw = io_apic_read(ioapic, 1);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    reg_01.raw = io_apic_read(ioapic, 1);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 
-       return reg_01.bits.version;
+    return reg_01.bits.version;
 }
 
 
 int __init io_apic_get_redir_entries (int ioapic)
 {
-       union IO_APIC_reg_01    reg_01;
-       unsigned long flags;
+    union IO_APIC_reg_01       reg_01;
+    unsigned long flags;
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       reg_01.raw = io_apic_read(ioapic, 1);
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    reg_01.raw = io_apic_read(ioapic, 1);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 
-       return reg_01.bits.entries;
+    return reg_01.bits.entries;
 }
 
 
 int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low)
 {
-       struct IO_APIC_route_entry entry;
-       unsigned long flags;
+    struct IO_APIC_route_entry entry;
+    unsigned long flags;
 
-       if (!IO_APIC_IRQ(irq)) {
-               printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
-                       ioapic);
-               return -EINVAL;
-       }
+    if (!IO_APIC_IRQ(irq)) {
+        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
+               ioapic);
+        return -EINVAL;
+    }
 
-       /*
-        * Generate a PCI IRQ routing entry and program the IOAPIC accordingly.
-        * Note that we mask (disable) IRQs now -- these get enabled when the
-        * corresponding device driver registers for this IRQ.
-        */
+    /*
+     * Generate a PCI IRQ routing entry and program the IOAPIC accordingly.
+     * Note that we mask (disable) IRQs now -- these get enabled when the
+     * corresponding device driver registers for this IRQ.
+     */
 
-       memset(&entry,0,sizeof(entry));
+    memset(&entry,0,sizeof(entry));
 
-       entry.delivery_mode = INT_DELIVERY_MODE;
-       entry.dest_mode = INT_DEST_MODE;
-       entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
-       entry.trigger = edge_level;
-       entry.polarity = active_high_low;
-       entry.mask  = 1;
+    entry.delivery_mode = INT_DELIVERY_MODE;
+    entry.dest_mode = INT_DEST_MODE;
+    entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
+    entry.trigger = edge_level;
+    entry.polarity = active_high_low;
+    entry.mask  = 1;
 
-       /*
-        * IRQs < 16 are already in the irq_2_pin[] map
-        */
-       if (irq >= 16)
-               add_pin_to_irq(irq, ioapic, pin);
+    /*
+     * IRQs < 16 are already in the irq_2_pin[] map
+     */
+    if (irq >= 16)
+        add_pin_to_irq(irq, ioapic, pin);
 
-       entry.vector = assign_irq_vector(irq);
+    entry.vector = assign_irq_vector(irq);
 
-       apic_printk(APIC_DEBUG, KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry "
+    apic_printk(APIC_DEBUG, KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry "
                "(%d-%d -> 0x%x -> IRQ %d Mode:%i Active:%i)\n", ioapic,
                mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
                edge_level, active_high_low);
 
-       ioapic_register_intr(irq, entry.vector, edge_level);
+    ioapic_register_intr(irq, entry.vector, edge_level);
 
-       if (!ioapic && (irq < 16))
-               disable_8259A_irq(irq);
+    if (!ioapic && (irq < 16))
+        disable_8259A_irq(irq);
 
-       spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1));
-       io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
-       spin_unlock_irqrestore(&ioapic_lock, flags);
+    spin_lock_irqsave(&ioapic_lock, flags);
+    io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1));
+    io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
+    spin_unlock_irqrestore(&ioapic_lock, flags);
 
-       return 0;
+    return 0;
 }
 
 #endif /*CONFIG_ACPI_BOOT*/
@@ -1782,7 +1700,7 @@ int ioapic_guest_read(int apicid, int address, u32 *pval)
 
     if ( (apicid >= NR_IOAPIC_BIOSIDS) ||
          ((apicenum = ioapic_biosid_to_apic_enum[apicid]) >= nr_ioapics) )
-            return -EINVAL;
+        return -EINVAL;
 
     spin_lock_irqsave(&ioapic_lock, flags);
     val = io_apic_read(apicenum, address);
@@ -1809,7 +1727,7 @@ int ioapic_guest_write(int apicid, int address, u32 val)
 
     if ( (apicid >= NR_IOAPIC_BIOSIDS) ||
          ((apicenum = ioapic_biosid_to_apic_enum[apicid]) >= nr_ioapics) )
-            return -EINVAL;
+        return -EINVAL;
 
     /* Only write to the first half of a route entry. */
     if ( (address < 0x10) || (address & 1) )
index 2d5335af286d1792c2e06dc06ef9391ce7319749..7307e9bead8fc2b9ea0a2b532d3b89d209548b69 100644 (file)
@@ -20,12 +20,12 @@ static void __do_IRQ_guest(int vector);
 
 void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs) { }
 
-static void enable_none(unsigned int irq) { }
-static unsigned int startup_none(unsigned int irq) { return 0; }
-static void disable_none(unsigned int irq) { }
-static void ack_none(unsigned int irq)
+static void enable_none(unsigned int vector) { }
+static unsigned int startup_none(unsigned int vector) { return 0; }
+static void disable_none(unsigned int vector) { }
+static void ack_none(unsigned int vector)
 {
-    printk("Unexpected IRQ trap at vector %02x.\n", irq);
+    printk("Unexpected IRQ trap at vector %02x.\n", vector);
     ack_APIC_irq();
 }
 
@@ -55,7 +55,7 @@ inline void disable_irq_nosync(unsigned int irq)
     if ( desc->depth++ == 0 )
     {
         desc->status |= IRQ_DISABLED;
-        desc->handler->disable(irq);
+        desc->handler->disable(vector);
     }
 
     spin_unlock_irqrestore(&desc->lock, flags);
@@ -74,7 +74,7 @@ void enable_irq(unsigned int irq)
         desc->status &= ~IRQ_DISABLED;
         if ( (desc->status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING )
             desc->status |= IRQ_REPLAY;
-        desc->handler->enable(irq);
+        desc->handler->enable(vector);
     }
 
     spin_unlock_irqrestore(&desc->lock, flags);
@@ -83,14 +83,13 @@ void enable_irq(unsigned int irq)
 asmlinkage void do_IRQ(struct cpu_user_regs *regs)
 {
     unsigned int      vector = regs->entry_vector;
-    unsigned int      irq = vector_to_irq(vector);
     irq_desc_t       *desc = &irq_desc[vector];
     struct irqaction *action;
 
     perfc_incrc(irqs);
 
     spin_lock(&desc->lock);
-    desc->handler->ack(irq);
+    desc->handler->ack(vector);
 
     if ( likely(desc->status & IRQ_GUEST) )
     {
@@ -117,7 +116,7 @@ asmlinkage void do_IRQ(struct cpu_user_regs *regs)
         desc->status &= ~IRQ_PENDING;
         irq_enter(smp_processor_id());
         spin_unlock_irq(&desc->lock);
-        action->handler(irq, action->dev_id, regs);
+        action->handler(vector_to_irq(vector), action->dev_id, regs);
         spin_lock_irq(&desc->lock);
         irq_exit(smp_processor_id());
     }
@@ -125,7 +124,7 @@ asmlinkage void do_IRQ(struct cpu_user_regs *regs)
     desc->status &= ~IRQ_INPROGRESS;
 
  out:
-    desc->handler->end(irq);
+    desc->handler->end(vector);
     spin_unlock(&desc->lock);
 }
 
@@ -163,7 +162,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)
     desc->action  = new;
     desc->depth   = 0;
     desc->status &= ~IRQ_DISABLED;
-    desc->handler->startup(irq);
+    desc->handler->startup(vector);
 
     spin_unlock_irqrestore(&desc->lock,flags);
 
@@ -220,7 +219,7 @@ int pirq_guest_unmask(struct domain *d)
             if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
                  test_and_clear_bit(pirq, &d->pirq_mask) &&
                  (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
-                desc->handler->end(pirq);
+                desc->handler->end(irq_to_vector(pirq));
             spin_unlock_irq(&desc->lock);
         }
     }
@@ -273,12 +272,12 @@ int pirq_guest_bind(struct vcpu *v, int irq, int will_share)
         desc->depth = 0;
         desc->status |= IRQ_GUEST;
         desc->status &= ~IRQ_DISABLED;
-        desc->handler->startup(irq);
+        desc->handler->startup(vector);
 
         /* Attempt to bind the interrupt target to the correct CPU. */
         cpu_set(v->processor, cpumask);
         if ( desc->handler->set_affinity != NULL )
-            desc->handler->set_affinity(irq, cpumask);
+            desc->handler->set_affinity(vector, cpumask);
     }
     else if ( !will_share || !action->shareable )
     {
@@ -318,7 +317,7 @@ int pirq_guest_unbind(struct domain *d, int irq)
 
     if ( test_and_clear_bit(irq, &d->pirq_mask) &&
          (--action->in_flight == 0) )
-        desc->handler->end(irq);
+        desc->handler->end(vector);
 
     if ( action->nr_guests == 1 )
     {
@@ -327,7 +326,7 @@ int pirq_guest_unbind(struct domain *d, int irq)
         desc->depth   = 1;
         desc->status |= IRQ_DISABLED;
         desc->status &= ~IRQ_GUEST;
-        desc->handler->shutdown(irq);
+        desc->handler->shutdown(vector);
     }
     else
     {
index 5e9448a84770f931c86d955731564b2742ee6bce..4cacb8b419dca99f7c587fdaab4a8a7c45bf00f8 100644 (file)
 
 #ifdef CONFIG_X86_IO_APIC
 
-#ifdef CONFIG_PCI_MSI
-static inline int use_pci_vector(void) {return 1;}
-static inline void disable_edge_ioapic_vector(unsigned int vector) { }
-static inline void end_edge_ioapic_vector (unsigned int vector) { }
-#define startup_level_ioapic   startup_level_ioapic_vector
-#define shutdown_level_ioapic  mask_IO_APIC_vector
-#define enable_level_ioapic    unmask_IO_APIC_vector
-#define disable_level_ioapic   mask_IO_APIC_vector
-#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_vector
-#define end_level_ioapic       end_level_ioapic_vector
-#define set_ioapic_affinity    set_ioapic_affinity_vector
-
-#define startup_edge_ioapic    startup_edge_ioapic_vector
-#define shutdown_edge_ioapic   disable_edge_ioapic_vector
-#define enable_edge_ioapic     unmask_IO_APIC_vector
-#define disable_edge_ioapic    disable_edge_ioapic_vector
-#define ack_edge_ioapic        ack_edge_ioapic_vector
-#define end_edge_ioapic        end_edge_ioapic_vector
-#else
-static inline int use_pci_vector(void) {return 0;}
-static inline void disable_edge_ioapic_irq(unsigned int irq) { }
-static inline void end_edge_ioapic_irq (unsigned int irq) { }
-#define startup_level_ioapic   startup_level_ioapic_irq
-#define shutdown_level_ioapic  mask_IO_APIC_irq
-#define enable_level_ioapic    unmask_IO_APIC_irq
-#define disable_level_ioapic   mask_IO_APIC_irq
-#define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_irq
-#define end_level_ioapic       end_level_ioapic_irq
-#define set_ioapic_affinity    set_ioapic_affinity_irq
-
-#define startup_edge_ioapic    startup_edge_ioapic_irq
-#define shutdown_edge_ioapic   disable_edge_ioapic_irq
-#define enable_edge_ioapic     unmask_IO_APIC_irq
-#define disable_edge_ioapic    disable_edge_ioapic_irq
-#define ack_edge_ioapic        ack_edge_ioapic_irq
-#define end_edge_ioapic        end_edge_ioapic_irq
-#endif
-
 #define IO_APIC_BASE(idx) \
                ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
                + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
index 5238b03ae19477c261d962fa7b449124162c5819..8ebbeb184ac02aac6fd5bbafdd4a4fabd34d682d 100644 (file)
 
 #define IO_APIC_IRQ(irq)    (((irq) >= 16) || ((1<<(irq)) & io_apic_irqs))
 #define IO_APIC_VECTOR(irq) (irq_vector[irq])
-#define LEGACY_VECTOR(irq)  ((irq) + FIRST_EXTERNAL_VECTOR)
+
+#define LEGACY_VECTOR(irq)          ((irq) + FIRST_EXTERNAL_VECTOR)
+#define LEGACY_IRQ_FROM_VECTOR(vec) ((vec) - FIRST_EXTERNAL_VECTOR)
+
 #define irq_to_vector(irq)  \
     (IO_APIC_IRQ(irq) ? IO_APIC_VECTOR(irq) : LEGACY_VECTOR(irq))
 #define vector_to_irq(vec)  (vector_irq[vec])
@@ -29,13 +32,10 @@ void enable_8259A_irq(unsigned int irq);
 int i8259A_irq_pending(unsigned int irq);
 void make_8259A_irq(unsigned int irq);
 void init_8259A(int aeoi);
-void send_IPI_self(int vector);
-void init_VISWS_APIC_irqs(void);
+
 void setup_IO_APIC(void);
 void disable_IO_APIC(void);
 void print_IO_APIC(void);
-int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
-void send_IPI(int dest, int vector);
 void setup_ioapic_dest(void);
 
 extern unsigned long io_apic_irqs;